How to use the cloudinary-core.Cloudinary function in cloudinary-core

To help you get started, we’ve selected a few cloudinary-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github diegopamio / vue-cloudinary / index.js View on Github external
export function install(Vue, options) {
  configuration = new cloudinary.Configuration(options);
  // if (cloudinary.CloudinaryJQuery && jQuery) {
  //   // cloudinary is attached to the global `jQuery` object
  //   jQuery.cloudinary.config(configuration.config());
  //   cloudinaryInstance = jQuery.cloudinary;
  // } else {
  cloudinaryInstance = new cloudinary.Cloudinary(configuration.config());
  // }
  cloudinary.Util.assign(cloudinaryInstance, cloudinary); // copy namespace to the service instance
  Vue.directive('cl-image', clImage);

}
github trivago / babel-plugin-cloudinary / lib / cloudinary-proxy.js View on Github external
* This module serves as a proxy to the cloudinary core. In addition
 * it adds some extra functionality based on the runtime configuration
 * file cloudinaryrc.json.
 */
const _has = require("lodash/has");
const cloudinary = require("cloudinary-core");

// https://cloudinary.com/documentation/solution_overview#configuration_parameters
const runConfig = require(`${process.env.INIT_CWD}/cloudinaryrc.json`);

if (!_has(runConfig, "native.cloud_name")) {
  throw new Error("You need to provide a **native** object with the mandatory **cloud_name** field");
}

const CALLEE_NAME = "__buildCloudinaryUrl";
const cl = new cloudinary.Cloudinary(runConfig.native);
const BASE_URL_PLACEHOLDER = new RegExp(`res.cloudinary.com/${runConfig.native.cloud_name}/image/upload`, "gi");

/**
 * This method invokes the cloudinary core to build the asset URL.
 * It also performs additional operations upon the URL based on
 * the client runtime configs.
 * @param {string} assetName - name of the asset.
 * @param {Object} transforms - plain object that contains the cloudinary transformations.
 * @returns {string} base image URL for the provided assetName.
 */
function getBaseImageUrl(assetName, transforms) {
  const enrichedTransforms = runConfig.defaultTransforms
    ? { ...runConfig.defaultTransforms, ...transforms }
    : transforms;

  let url = cl.url(assetName, enrichedTransforms);
github diegopamio / vue-cloudinary / dist / vue-cloudinary.common.js View on Github external
function install(Vue, options) {
  configuration = new cloudinary.Configuration(options);
  // if (cloudinary.CloudinaryJQuery && jQuery) {
  //   // cloudinary is attached to the global `jQuery` object
  //   jQuery.cloudinary.config(configuration.config());
  //   cloudinaryInstance = jQuery.cloudinary;
  // } else {
  cloudinaryInstance = new cloudinary.Cloudinary(configuration.config());
  // }
  cloudinary.Util.assign(cloudinaryInstance, cloudinary); // copy namespace to the service instance
  Vue.directive('cl-image', clImage);

}
github contentful / extensions / marketplace / cloudinary-assets / src / index.js View on Github external
function makeThumbnail(resource, config) {
  const cloudinary = new cloudinaryCore({
    cloud_name: config.cloudName,
    api_key: config.apiKey
  });

  let url;
  const alt = [resource.public_id, ...(resource.tags || [])].join(', ');
  let transformations = 'w_150,h_100,c_fill';

  if (
    Array.isArray(resource.derived) &&
    resource.derived[0] &&
    resource.derived[0].raw_transformation
  ) {
    transformations = resource.derived[0].raw_transformation + '/' + transformations;
  }
github cloudinary / cloudinary-video-player / src / plugins / cloudinary / models / base-source.js View on Github external
config() {
    const cld = new cloudinary.Cloudinary(this.cloudinaryConfig().config());
    cld.config(this.resourceConfig());

    return cld;
  }
github cloudinary / cloudinary-video-player / src / plugins / cloudinary / common.js View on Github external
const mergeCloudinaryConfig = (config1, config2) => {
  if (config1.constructor.name === 'Cloudinary' && config1.config) {
    config1 = config1.config();
  }

  const newConfig = new cloudinary.Cloudinary(config1);

  if (config2.constructor.name === 'Cloudinary' && config2.config) {
    config2 = config1.config();
  }

  return newConfig.config(config2);
};
github contentful / extensions / marketplace / cloudinary-assets / src / components / cloudinaryThumbnail / cloudinaryThumbnail.tsx View on Github external
export default function CloudinaryThumbnail(props: CloudinaryThumbnailProps) {
  const cloudinary = new cloudinaryCore({
    cloud_name: props.config.cloudName,
    api_key: props.config.apiKey
  });

  const resourceName = props.resource.public_id + props.resource.tags.join(', ');

  if (
    props.resource.resource_type === 'image' &&
    ['svg', 'jpg', 'png', 'gif', 'jpeg'].includes(props.resource.format)
  ) {
    return (