How to use cloudinary-core - 10 common examples

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 cloudinary / cloudinary-react / src / Util / extractCloudinaryProps.js View on Github external
import {Transformation, Util} from 'cloudinary-core';

const CLOUDINARY_REACT_PROPS = {includeOwnBody: true};

// Map Cloudinary props from array to object for efficient lookup
const CLOUDINARY_PROPS = Transformation.PARAM_NAMES.map(Util.camelCase).reduce(
  (accumulator, cloudinaryPropName) => {
    accumulator[cloudinaryPropName] = true;
    return accumulator;
  },
  {}
);

const isDefined = (props, key) => {
  return (props[key] !== undefined && props[key] !== null);
};

/**
 * Extracts cloudinaryProps and nonCloudinaryProps from given props
 *
 * @param props
 * @returns {{children: *, cloudinaryReactProps: {}, cloudinaryProps: {}, nonCloudinaryProps: {}}}
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 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 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 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 cloudinary / cloudinary-react / src / components / Image / Image.js View on Github external
calc_breakpoint(width, steps) {
    var breakpoints, point;
    breakpoints = (this.state && this.state.breakpoints) || defaultBreakpoints;
    if (Util.isFunction(breakpoints)) {
      return breakpoints(width, steps);
    } else {
      if (Util.isString(breakpoints)) {
        breakpoints = ((function () {
          var j, len, ref, results;
          ref = breakpoints.split(',');
          results = [];
          for (j = 0, len = ref.length; j < len; j++) {
            point = ref[j];
            results.push(parseInt(point));
          }
          return results;
        })()).sort(function (a, b) {
          return a - b;
        });
      }
github cloudinary / cloudinary-react / src / components / Image / Image.js View on Github external
calc_breakpoint(width, steps) {
    var breakpoints, point;
    breakpoints = (this.state && this.state.breakpoints) || defaultBreakpoints;
    if (Util.isFunction(breakpoints)) {
      return breakpoints(width, steps);
    } else {
      if (Util.isString(breakpoints)) {
        breakpoints = ((function () {
          var j, len, ref, results;
          ref = breakpoints.split(',');
          results = [];
          for (j = 0, len = ref.length; j < len; j++) {
            point = ref[j];
            results.push(parseInt(point));
          }
          return results;
        })()).sort(function (a, b) {
          return a - b;
        });
      }
      return closestAbove(breakpoints, width);
    }
  };