How to use the cloudinary.utils function in cloudinary

To help you get started, we’ve selected a few cloudinary 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 streetmix / streetmix / app / resources / services / images.js View on Github external
if (!user) {
    res.status(404).send('User not found.')
    return
  }

  // Is requesting user logged in?
  if (user.login_tokens.indexOf(req.loginToken) === -1) {
    res.status(401).end()
    return
  }

  // If requesting user is logged in, permission granted to receive cloudinary signature.
  let signature
  try {
    signature = await cloudinary.utils.api_sign_request(query, config.cloudinary.api_secret)
  } catch (error) {
    logger.error(error)
    res.status(500).send('Error generating signature.')
  }

  if (!signature) {
    res.status(404).send('Signature could not be generated.')
  }

  const payload = {
    signature: signature,
    timestamp: query.timestamp,
    api_key: config.cloudinary.api_key
  }

  res.status(200).json(payload)
github streetmix / streetmix / app / resources / services / cloudinary.js View on Github external
if (!user) {
    res.status(404).send('User not found.')
    return
  }

  // Is requesting user logged in?
  if (user.login_tokens.indexOf(req.loginToken) === -1) {
    res.status(401).end()
    return
  }

  // If requesting user is logged in, permission granted to receive cloudinary signature.
  let signature
  try {
    signature = await cloudinary.utils.api_sign_request(query, config.cloudinary.api_secret)
  } catch (error) {
    logger.error(error)
    res.status(500).send('Error generating signature.')
  }

  if (!signature) {
    res.status(404).send('Signature could not be generated.')
  }

  const payload = {
    signature: signature,
    timestamp: query.timestamp,
    api_key: config.cloudinary.api_key
  }

  res.status(200).json(payload)
github olymp / olymp / packages / scrape / server / graphql.es6 View on Github external
const getPromise = (metadata, prop) => {
  if (metadata[prop]) {
    try {
      return {
        id: metadata[prop],
        url: cloudinary.utils.url(metadata[prop], {
          type: 'fetch',
          transformation: props[prop],
        }),
        width: props[prop].width,
        height: props[prop].height,
      };
    } catch (err) {}
  }
};
github olymp / olymp / _ / cms / cloudinary / server / cloudinary.js View on Github external
var getSignedRequest = exports.getSignedRequest = function getSignedRequest(config) {
  return transformSignature(config, cloudinary.utils.sign_request({
    timestamp: Math.round(new Date().getTime() / 1000),
    folder: APP ? APP + '/' : null
  }, config));
};
github olymp / olymp / _ / cms / cloudinary / server / cloudinary.es6 View on Github external
export const getSignedRequest = config =>
  transformSignature(
    config,
    cloudinary.utils.sign_request(
      {
        timestamp: Math.round(new Date().getTime() / 1000),
        folder: APP ? `${APP}/` : null,
      },
      config,
    ),
  );