next-cloudinary 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +84 -200
- package/dist/next-cloudinary.js +884 -0
- package/dist/next-cloudinary.js.map +1 -0
- package/dist/next-cloudinary.modern.mjs +888 -0
- package/dist/next-cloudinary.modern.mjs.map +1 -0
- package/dist/next-cloudinary.module.js +871 -0
- package/dist/next-cloudinary.module.js.map +1 -0
- package/dist/next-cloudinary.umd.js +884 -0
- package/dist/next-cloudinary.umd.js.map +1 -0
- package/package.json +2 -2
- package/babel.config.js +0 -9
- package/jest.config.js +0 -7
- package/tests/lib/cloudinary.spec.js +0 -129
- package/tests/loaders/cloudinary-loader.spec.js +0 -84
- package/tests/plugins/cropping.spec.js +0 -38
- package/tests/plugins/overlays.spec.js +0 -112
- package/tests/plugins/raw-transformations.spec.js +0 -54
- package/tests/plugins/underlays.spec.js +0 -62
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"next-cloudinary.umd.js","sources":["../src/plugins/cropping.js","../src/plugins/effects.js","../src/constants/qualifiers.js","../src/plugins/overlays.js","../src/plugins/raw-transformations.js","../src/plugins/remove-background.js","../src/plugins/underlays.js","../src/plugins/zoompan.js","../src/lib/cloudinary.js","../src/loaders/cloudinary-loader.js","../src/components/CldImage/CldImage.js","../src/components/CldOgImage/CldOgImage.js","../src/components/CldUploadWidget/CldUploadWidget.js","../src/components/CldUploadButton/CldUploadButton.js"],"sourcesContent":["const cropsGravityAuto = [ 'crop', 'fill', 'lfill', 'fill_pad', 'thumb' ];\n\nexport const props = ['crop', 'gravity'];\n\nexport function plugin({ cldImage, options } = {}) {\n const { width, height, crop = 'limit' } = options;\n\n let transformationString = `c_${crop},w_${width}`;\n\n if ( !options.gravity && cropsGravityAuto.includes(crop) ) {\n options.gravity = 'auto';\n }\n\n if ( !['limit'].includes(crop) ) {\n transformationString = `${transformationString},h_${height}`;\n }\n\n if ( options.gravity ) {\n if ( options.gravity === 'auto' && !cropsGravityAuto.includes(crop) ) {\n console.warn('Auto gravity can only be used with crop, fill, lfill, fill_pad or thumb. Not applying gravity.');\n } else {\n transformationString = `${transformationString},g_${options.gravity}`;\n }\n }\n\n cldImage.resize(transformationString);\n}\n","const params = [\n 'art',\n {\n prop: 'autoBrightness',\n effect: 'auto_brightness',\n },\n {\n prop: 'autoColor',\n effect: 'auto_color',\n },\n {\n prop: 'autoContrast',\n effect: 'auto_contrast',\n },\n {\n prop: 'assistColorblind',\n effect: 'assist_colorblind',\n },\n 'blackwhite',\n 'blur',\n {\n prop: 'blurFaces',\n effect: 'blur_faces',\n },\n {\n prop: 'blurRegion',\n effect: 'blur_region',\n },\n 'brightness',\n {\n prop: 'brightnessHSB',\n effect: 'brightness_hsb',\n },\n 'cartoonify',\n 'colorize',\n 'contrast',\n 'distort',\n {\n prop: 'fillLight',\n effect: 'fill_light',\n },\n 'gamma',\n {\n prop: 'gradientFade',\n effect: 'gradient_fade',\n },\n 'grayscale',\n 'improve',\n 'negate',\n {\n prop: 'oilPaint',\n effect: 'oil_paint',\n },\n 'outline',\n 'pixelate',\n {\n prop: 'pixelateFaces',\n effect: 'pixelate_faces',\n },\n {\n prop: 'pixelateRegion',\n effect: 'pixelate_region',\n },\n 'redeye',\n {\n prop: 'replaceColor',\n effect: 'replace_color',\n },\n 'saturation',\n 'sepia',\n 'shadow',\n 'sharpen',\n 'shear',\n {\n prop: 'simulateColorblind',\n effect: 'simulate_colorblind',\n },\n 'tint',\n {\n prop: 'unsharpMask',\n effect: 'unsharp_mask',\n },\n 'vectorize',\n 'vibrance',\n 'vignette',\n];\n\nexport const props = params.map(param => param.prop || param);\n\nexport function plugin({ cldImage, options } = {}) {\n params.forEach(key => {\n const prop = key.prop || key;\n const effect = key.effect || key;\n\n if ( options[prop] === true ) {\n cldImage.effect(`e_${effect}`);\n } else if ( typeof options[prop] === 'string' ) {\n cldImage.effect(`e_${effect}:${options[prop]}`);\n }\n });\n}","// aspectRatio\n\nexport const primary = {\n aspectRatio: {\n qualifier: 'ar'\n },\n crop: {\n qualifier: 'c'\n },\n gravity: {\n qualifier: 'g'\n },\n height: {\n qualifier: 'h'\n },\n width: {\n qualifier: 'w'\n },\n};\n\nexport const position = {\n angle: {\n qualifier: 'a'\n },\n gravity: {\n qualifier: 'g'\n },\n x: {\n qualifier: 'x'\n },\n y: {\n qualifier: 'y'\n },\n}\n\nexport const text = {\n color: {\n qualifier: 'co',\n location: 'primary'\n },\n fontFamily: {\n qualifier: false\n },\n fontSize: {\n qualifier: false\n },\n fontWeight: {\n qualifier: false\n },\n letterSpacing: {\n qualifier: 'letter_spacing'\n },\n textDecoration: {\n qualifier: false\n }\n}","import {\n primary as qualifiersPrimary,\n text as qualifiersText,\n position as qualifiersPosition\n} from '../constants/qualifiers';\n\nexport const props = ['text', 'overlays'];\n\nexport const DEFAULT_TEXT_OPTIONS = {\n color: 'black',\n fontFamily: 'Arial',\n fontSize: 200,\n fontWeight: 'bold',\n};\n\nexport function plugin({ cldImage, options } = {}) {\n const { text, overlays = [] } = options;\n\n const type = 'overlay';\n const typeQualifier = 'l';\n\n if ( Array.isArray(overlays) ) {\n overlays.forEach(applyOverlay);\n }\n\n if ( typeof text === 'string' ) {\n applyOverlay({\n text: {\n ...DEFAULT_TEXT_OPTIONS,\n text\n }\n })\n } else if ( typeof text === 'object' ) {\n applyOverlay({\n text: {\n ...DEFAULT_TEXT_OPTIONS,\n ...text\n }\n })\n }\n\n\n\n /**\n * applyOverlay\n */\n\n function applyOverlay({ publicId, position, text, effects: layerEffects = [], ...options }) {\n const hasPublicId = typeof publicId === 'string';\n const hasText = typeof text === 'object' || typeof text === 'string';\n const hasPosition = typeof position === 'object';\n\n if ( !hasPublicId && !hasText ) {\n console.warn(`An ${type} is missing Public ID or Text`);\n return;\n }\n\n // Start to construct the transformation string using text or the public ID\n // if it's image-based\n\n let layerTransformation;\n\n if ( hasText ) {\n layerTransformation = `${typeQualifier}_text`;\n } else {\n layerTransformation = `${typeQualifier}_${publicId.replace(/\\//g, ':')}`;\n }\n\n // Begin organizing transformations based on what it is and the location\n // it needs to be placed in the URL\n\n const primary = [];\n const applied = [];\n\n // Gemeral options\n\n Object.keys(options).forEach(key => {\n if ( !qualifiersPrimary[key] ) return;\n const { qualifier } = qualifiersPrimary[key];\n primary.push(`${qualifier}_${options[key]}`);\n });\n\n // Layer effects\n\n layerEffects.forEach(effect => {\n Object.keys(effect).forEach(key => {\n if ( !qualifiersPrimary[key] ) return;\n const { qualifier } = qualifiersPrimary[key];\n primary.push(`${qualifier}_${effect[key]}`);\n });\n });\n\n // Text styling\n\n if ( hasText ) {\n if ( typeof text === 'string' ) {\n text = {\n ...DEFAULT_TEXT_OPTIONS,\n text\n }\n }\n\n\n const textTransformations = [];\n\n Object.keys(text).forEach(key => {\n if ( !qualifiersText[key] ) return;\n\n const { qualifier, location } = qualifiersText[key];\n\n if ( location === 'primary' ) {\n primary.push(`${qualifier}_${text[key]}`);\n } else {\n textTransformations.push(text[key]);\n }\n });\n\n layerTransformation = `${layerTransformation}:${textTransformations.join('_')}:${text.text}`\n }\n\n // Positioning\n\n if ( hasPosition ) {\n Object.keys(position).forEach(key => {\n if ( !qualifiersPosition[key] ) return;\n\n const { qualifier } = qualifiersPosition[key];\n\n applied.push(`${qualifier}_${position[key]}`);\n });\n }\n\n // Add all primary transformations\n\n layerTransformation = `${layerTransformation},${primary.join(',')}`;\n\n // Add all applied transformations\n\n layerTransformation = `${layerTransformation}/fl_layer_apply,fl_no_overflow`;\n\n if ( applied.length > 0 ) {\n layerTransformation = `${layerTransformation},${applied.join(',')}`;\n }\n\n // Finally add it to the image\n\n cldImage.addTransformation(layerTransformation);\n }\n}","export const props = ['rawTransformations'];\n\nexport function plugin({ cldImage, options } = {}) {\n const { rawTransformations = [] } = options;\n\n rawTransformations.forEach(transformation => {\n cldImage.addTransformation(transformation);\n });\n}","export const props = ['removeBackground'];\n\nexport function plugin({ cldImage, options } = {}) {\n const { removeBackground = false } = options;\n if ( removeBackground ) {\n cldImage.effect('e_background_removal');\n }\n}","import {\n primary as qualifiersPrimary,\n text as qualifiersText,\n position as qualifiersPosition\n} from '../constants/qualifiers';\n\nexport const props = ['underlay', 'underlays'];\n\nexport function plugin({ cldImage, options } = {}) {\n const { underlay, underlays = [] } = options;\n\n const type = 'underlay';\n const typeQualifier = 'u';\n\n if ( Array.isArray(underlays) ) {\n underlays.forEach(applyUnderlay);\n }\n\n if ( typeof underlay === 'string' ) {\n\n const underlayOptions = {\n publicId: underlay,\n crop: 'fill'\n }\n\n if ( options.width ) {\n underlayOptions.width = options.width;\n }\n\n if ( options.height ) {\n underlayOptions.height = options.height;\n }\n\n applyUnderlay(underlayOptions);\n }\n\n /**\n * applyUnderlay\n */\n\n function applyUnderlay({ publicId, type, position, text, effects: layerEffects = [], ...options }) {\n const hasPublicId = typeof publicId === 'string';\n const hasPosition = typeof position === 'object';\n\n if ( !hasPublicId ) {\n console.warn(`An ${type} is missing a Public ID`);\n return;\n }\n\n // Start to construct the transformation string using text or the public ID\n // if it's image-based\n\n let layerTransformation = `${typeQualifier}_${publicId.replace(/\\//g, ':')}`;\n\n // Begin organizing transformations based on what it is and the location\n // it needs to be placed in the URL\n\n const primary = [];\n const applied = [];\n\n // Gemeral options\n\n Object.keys(options).forEach(key => {\n if ( !qualifiersPrimary[key] ) return;\n const { qualifier } = qualifiersPrimary[key];\n primary.push(`${qualifier}_${options[key]}`);\n });\n\n // Layer effects\n\n layerEffects.forEach(effect => {\n Object.keys(effect).forEach(key => {\n if ( !qualifiersPrimary[key] ) return;\n const { qualifier } = qualifiersPrimary[key];\n primary.push(`${qualifier}_${effect[key]}`);\n });\n });\n\n // Positioning\n\n if ( hasPosition ) {\n Object.keys(position).forEach(key => {\n if ( !qualifiersPosition[key] ) return;\n\n const { qualifier } = qualifiersPosition[key];\n\n applied.push(`${qualifier}_${position[key]}`);\n });\n }\n\n // Add all primary transformations\n\n layerTransformation = `${layerTransformation},${primary.join(',')}`;\n\n // Add all applied transformations\n\n layerTransformation = `${layerTransformation}/fl_layer_apply,fl_no_overflow`;\n\n if ( applied.length > 0 ) {\n layerTransformation = `${layerTransformation},${applied.join(',')}`;\n }\n\n // Finally add it to the image\n\n cldImage.addTransformation(layerTransformation);\n }\n}","export const props = ['zoompan'];\n\nexport function plugin({ cldImage, options } = {}) {\n const { zoompan = false } = options;\n const overrides = {};\n\n if ( zoompan === true ) {\n cldImage.effect('e_zoompan');\n } else if ( typeof zoompan === 'string' ) {\n if ( zoompan === 'loop' ) {\n cldImage.effect('e_zoompan');\n cldImage.effect('e_loop');\n } else {\n cldImage.effect(`e_zoompan:${zoompan}`);\n }\n } else if ( typeof zoompan === 'object' ) {\n let zoompanEffect = 'e_zoompan';\n\n if ( typeof zoompan.options === 'string' ) {\n zoompanEffect = `${zoompanEffect}${zoompan.options}`;\n }\n\n cldImage.effect(zoompanEffect);\n\n let loopEffect;\n\n if ( zoompan.loop === true ) {\n loopEffect = 'e_loop';\n } else if ( typeof zoompan.loop === 'string' ) {\n loopEffect = `e_loop${zoompan.loop}`;\n }\n\n if ( loopEffect ) {\n cldImage.effect(loopEffect);\n }\n }\n\n if ( zoompan !== false ) {\n overrides.format = 'gif';\n }\n\n return {\n options: overrides\n }\n}","import { Cloudinary } from '@cloudinary/url-gen';\n\nimport * as croppingPlugin from '../plugins/cropping';\nimport * as effectsPlugin from '../plugins/effects';\nimport * as overlaysPlugin from '../plugins/overlays';\nimport * as rawTransformationsPlugin from '../plugins/raw-transformations';\nimport * as removeBackgroundPlugin from '../plugins/remove-background';\nimport * as underlaysPlugin from '../plugins/underlays';\nimport * as zoompanPlugin from '../plugins/zoompan';\n\nimport {\n primary as qualifiersPrimary,\n text as qualifiersText,\n position as qualifiersPosition\n} from '../constants/qualifiers';\n\nexport const transformationPlugins = [\n // Background Removal must always come first\n removeBackgroundPlugin,\n\n croppingPlugin,\n effectsPlugin,\n overlaysPlugin,\n underlaysPlugin,\n zoompanPlugin,\n\n // Raw transformations needs to be last simply to make sure\n // it's always expected to applied the same way\n\n rawTransformationsPlugin\n];\n\nlet cld;\n\n/**\n * constructCloudinaryUrl\n */\n\nexport function constructCloudinaryUrl({ options, config }) {\n if ( !cld ) {\n cld = new Cloudinary({\n cloud: {\n cloudName: process.env.NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME\n },\n url: {\n // Used to avoid issues with SSR particularly for the blurred placeholder\n analytics: false\n },\n ...config\n });\n }\n\n const publicId = getPublicId(options.src);\n\n const cldImage = cld.image(publicId);\n\n transformationPlugins.forEach(({ plugin }) => {\n const { options: pluginOptions } = plugin({\n cldImage,\n options\n }) || {};\n\n if ( pluginOptions?.format ) {\n options.format = pluginOptions.format;\n }\n });\n\n return cldImage\n .setDeliveryType(options.deliveryType || 'upload')\n .format(options.format || 'auto')\n .delivery(`q_${options.quality || 'auto'}`)\n .toURL();\n}\n\n/**\n * Retrieves the public id of a cloudiary image url. If no url is recognized it returns the parameter it self.\n * If it's recognized that is a url and it's not possible to get the public id, it warns the user.\n *\n * @param {string} src The cloudiary url or public id.\n *\n * @return {string} The images public id\n */\n\nexport function getPublicId(src) {\n if ( typeof src !== 'string' ) {\n throw new Error(`Invalid src of type ${typeof src}`);\n }\n\n if ( src.includes('res.cloudinary.com') ) {\n const regexWithTransformations = /(https?)\\:\\/\\/(res.cloudinary.com)\\/([^\\/]+)\\/(image|video|raw)\\/(upload|authenticated)\\/(.*)\\/(v[0-9]+)\\/(.+)(?:\\.[a-z]{3})?/\n const regexWithoutTransformations = /(https?)\\:\\/\\/(res.cloudinary.com)\\/([^\\/]+)\\/(image|video|raw)\\/(upload|authenticated)\\/(v[0-9]+)\\/(.+)(?:\\.[a-z]{3})?/\n\n const withTransformations = src.match(regexWithTransformations)\n const withoutTransformations = src.match(regexWithoutTransformations)\n\n if ( withTransformations ) {\n return withTransformations[withTransformations.length - 1]\n } else if ( withoutTransformations ) {\n return withoutTransformations[withoutTransformations.length - 1]\n } else {\n console.warn(`Not possible to retrieve the publicUrl from ${src}, make sure it's a valid cloudinary image url.`)\n }\n }\n\n return src;\n}\n\n/**\n * createPlaceholderUrl\n */\n\nexport function createPlaceholderUrl({ src, placeholder = true, config }) {\n const rawTransformations = [];\n\n if ( placeholder === 'grayscale' ) {\n rawTransformations.push('e_grayscale');\n }\n\n if ( typeof placeholder === 'string' && placeholder.includes('color:') ) {\n const color = placeholder.split(':').splice(1).join(':')\n rawTransformations.push('e_grayscale');\n rawTransformations.push(`e_colorize:60,co_${color}`);\n }\n\n return constructCloudinaryUrl({\n options: {\n src,\n width: 100,\n quality: 1,\n rawTransformations,\n },\n config\n });;\n}\n","import { constructCloudinaryUrl } from '../lib/cloudinary';\n\nexport function cloudinaryLoader(defaultOptions, cldOptions, cldConfig = {}) {\n return constructCloudinaryUrl({\n options: {\n ...defaultOptions,\n ...cldOptions\n },\n config: cldConfig\n });\n}","import Image from 'next/image';\n\nimport { createPlaceholderUrl, getPublicId, transformationPlugins } from '../../lib/cloudinary';\nimport { cloudinaryLoader } from '../../loaders/cloudinary-loader';\n\nconst CldImage = props => {\n\n const CLD_OPTIONS = [];\n\n transformationPlugins.forEach(({ props = [] }) => {\n props.forEach(prop => {\n if ( CLD_OPTIONS.includes(prop) ) {\n throw new Error(`Option ${prop} already exists!`);\n }\n CLD_OPTIONS.push(prop);\n });\n })\n\n // Construct the base Image component props by filtering out Cloudinary-specific props\n\n const imageProps = {};\n\n Object.keys(props)\n .filter(key => !CLD_OPTIONS.includes(key))\n .forEach(key => imageProps[key] = props[key]);\n\n // Construct Cloudinary-specific props by looking for values for any of the supported prop keys\n\n const cldOptions = {};\n\n CLD_OPTIONS.forEach(key => {\n if ( props[key] ) {\n cldOptions[key] = props[key];\n }\n });\n\n // If we see a placeholder option, configure a Cloudinary-based URL.\n // The resulting image will always be blurred per Next.js, so we're\n // limited on options for placeholders.\n //\n // We need to do this logic here as we potentially need to mutate\n // an Image component prop as opposed to simply the URL\n //\n // https://nextjs.org/docs/api-reference/next/image#blurdataurl\n\n if ( imageProps.placeholder ) {\n const publicId = getPublicId(props.src);\n\n imageProps.blurDataURL = createPlaceholderUrl({\n src: publicId,\n placeholder: props.placeholder\n });\n\n if ( imageProps.placeholder !== 'blur' ) {\n imageProps.placeholder = 'blur';\n }\n }\n\n return (\n <Image\n {...imageProps}\n loader={(options) => cloudinaryLoader({ ...imageProps, options }, cldOptions)}\n />\n );\n}\n\nexport default CldImage;","import Head from 'next/head';\n\nconst IMAGE_WIDTH = 2400;\nconst IMAGE_HEIGHT = 1200;\n\nimport { constructCloudinaryUrl } from '../../lib/cloudinary';\n\nconst TWITTER_CARD = 'summary_large_image';\n\nconst CldOgImage = ({ excludeTags = [], twitterTitle, ...props }) => {\n const options = {\n ...props,\n width: props.width || IMAGE_WIDTH,\n height: props.height || IMAGE_HEIGHT,\n crop: props.crop || 'fill',\n gravity: props.gravity || 'center'\n }\n\n const ogImageUrl = constructCloudinaryUrl({\n options\n });\n\n // We need to include the tags within the Next.js Head component rather than\n // direcly adding them inside of the Head otherwise we get unexpected results\n\n return (\n <Head>\n <meta property=\"og:image\" content={ogImageUrl} />\n <meta property=\"og:image:secure_url\" content={ogImageUrl} />\n <meta property=\"og:image:width\" content={options.width} />\n <meta property=\"og:image:height\" content={options.height} />\n\n {options.alt && (\n <meta property=\"og:image:alt\" content={options.alt} />\n )}\n\n {/* Required for summary_large_image, exclude vai excludeTags */}\n {/* https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/summary-card-with-large-image */}\n\n {!excludeTags.includes('twitter:title') && (\n <meta property=\"twitter:title\" content={twitterTitle || ' '} />\n )}\n\n <meta property=\"twitter:card\" content={TWITTER_CARD} />\n <meta property=\"twitter:image\" content={ogImageUrl} />\n </Head>\n );\n}\n\nexport default CldOgImage;","import { useRef } from 'react';\nimport Script from 'next/script';\n\nconst CldUploadWidget = ({\n children,\n onUpload,\n options,\n signed,\n signatureEndpoint,\n}) => {\n const cloudinary = useRef();\n const widget = useRef();\n\n /**\n * generateSignature\n * @description Makes a request to an endpoint to sign Cloudinary parameters as part of widget creation\n */\n\n function generateSignature(callback, paramsToSign) {\n fetch(signatureEndpoint, {\n method: \"POST\",\n body: JSON.stringify({\n paramsToSign,\n }),\n })\n .then((r) => r.json())\n .then(({ signature }) => {\n callback(signature);\n });\n }\n\n /**\n * createWidget\n * @description Creates a new instance of the Cloudinary widget and stores in a ref\n */\n\n function createWidget() {\n // When creating a signed upload, you need to provide both your Cloudinary API Key\n // as well as a signature generator function that will sign any paramters\n // either on page load or during the upload process. Read more about signed uploads at:\n // https://cloudinary.com/documentation/upload_widget#signed_uploads\n\n const totalOptions = {\n ...options,\n ...(!!signed && {\n uploadSignature: generateSignature,\n }),\n };\n\n // no need for apiSecret because of api/sign-cloudinary-params\n if (signed && !totalOptions.apiKey) {\n return new Error(\"Signed Upload needs apiKey!\");\n }\n\n return cloudinary.current?.createUploadWidget(\n totalOptions,\n function (error, result) {\n // The callback is a bit more chatty than failed or success so\n // only trigger when one of those are the case. You can additionally\n // create a separate handler such as onEvent and trigger it on\n // ever occurance\n if (error || result.event === \"success\") {\n onUpload(error, result, widget?.current);\n }\n }\n );\n }\n\n /**\n * open\n * @description When triggered, uses the current widget instance to open the upload modal\n */\n\n function open() {\n if (!widget?.current) {\n widget.current = createWidget();\n }\n\n widget?.current && widget.current.open();\n }\n\n /**\n * handleOnLoad\n * @description Stores the Cloudinary window instance to a ref when the widget script loads\n */\n\n function handleOnLoad() {\n cloudinary.current = window.cloudinary;\n }\n\n return (\n <>\n {children({\n cloudinary: cloudinary.current,\n widget: widget.current,\n open,\n })}\n <Script\n id={`cloudinary-${Math.floor(Math.random() * 100)}`}\n src=\"https://widget.cloudinary.com/v2.0/global/all.js\"\n onLoad={handleOnLoad}\n onError={(e) => {\n console.error(\"Script failed to load\", e);\n }}\n />\n </>\n );\n};\n\nexport default CldUploadWidget;\n","import CldUploadWidget from '../CldUploadWidget';\n\nconst CldUploadButton = ({\n onUpload,\n options,\n signed,\n label,\n children,\n ...props\n}) => {\n return (\n <>\n <CldUploadWidget\n signed={signed}\n options={options}\n onUpload={onUpload}\n signatureEndpoint={signed ?? props.signatureEndpoint}\n >\n {({ open }) => {\n function handleOnClick(e) {\n e.preventDefault();\n open();\n }\n return (\n <button onClick={handleOnClick} {...props}>\n {children}\n </button>\n );\n }}\n </CldUploadWidget>\n </>\n );\n};\n\nexport default CldUploadButton;\n"],"names":["cropsGravityAuto","props","plugin","cldImage","options","width","height","crop","transformationString","gravity","includes","console","warn","resize","params","prop","effect","map","param","forEach","key","primary","aspectRatio","qualifier","position","angle","x","y","text","color","location","fontFamily","fontSize","fontWeight","letterSpacing","textDecoration","DEFAULT_TEXT_OPTIONS","overlays","type","typeQualifier","Array","isArray","applyOverlay","publicId","effects","layerEffects","_excluded","hasPublicId","hasText","hasPosition","layerTransformation","replace","applied","Object","keys","qualifiersPrimary","push","textTransformations","qualifiersText","join","qualifiersPosition","length","addTransformation","rawTransformations","transformation","removeBackground","underlay","underlays","applyUnderlay","underlayOptions","zoompan","overrides","zoompanEffect","loopEffect","loop","format","transformationPlugins","removeBackgroundPlugin","croppingPlugin","effectsPlugin","overlaysPlugin","underlaysPlugin","zoompanPlugin","rawTransformationsPlugin","cld","constructCloudinaryUrl","config","Cloudinary","cloud","cloudName","process","env","NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME","url","analytics","getPublicId","src","image","pluginOptions","setDeliveryType","deliveryType","delivery","quality","toURL","Error","regexWithTransformations","regexWithoutTransformations","withTransformations","match","withoutTransformations","createPlaceholderUrl","placeholder","split","splice","cloudinaryLoader","defaultOptions","cldOptions","cldConfig","CldImage","CLD_OPTIONS","imageProps","filter","blurDataURL","_jsx","Image","IMAGE_WIDTH","IMAGE_HEIGHT","TWITTER_CARD","CldOgImage","excludeTags","twitterTitle","ogImageUrl","_jsxs","Head","alt","CldUploadWidget","children","onUpload","signed","signatureEndpoint","cloudinary","useRef","widget","generateSignature","callback","paramsToSign","fetch","method","body","JSON","stringify","then","r","json","signature","createWidget","totalOptions","uploadSignature","apiKey","current","createUploadWidget","error","result","event","open","handleOnLoad","window","_Fragment","Script","Math","floor","random","e","CldUploadButton","label","handleOnClick","preventDefault"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA,IAAMA,gBAAgB,GAAG,CAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,CAAE,CAAA;EAElE,IAAMC,OAAK,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;EAEjC,SAASC,QAAM,CAA6B,KAAA,EAAA;EAAA,EAAA,IAAA,IAAA,GAAA,KAAA,KAAA,KAAA,CAAA,GAAJ,EAAE,GAAA,KAAA;EAAxBC,IAAAA,QAAQ,QAARA,QAAQ;EAAEC,IAAAA,OAAO,QAAPA,OAAO,CAAA;EACxC,EAAA,IAAQC,KAAK,GAA6BD,OAAO,CAAzCC,KAAK;MAAEC,MAAM,GAAqBF,OAAO,CAAlCE,MAAM;MAAA,aAAqBF,GAAAA,OAAO,CAA1BG,IAAI;EAAJA,IAAAA,IAAI,8BAAG,OAAO,GAAA,aAAA,CAAA;EAErC,EAAA,IAAIC,oBAAoB,GAAA,IAAA,GAAQD,IAAI,GAAA,KAAA,GAAMF,KAAO,CAAA;IAEjD,IAAK,CAACD,OAAO,CAACK,OAAO,IAAIT,gBAAgB,CAACU,QAAQ,CAACH,IAAI,CAAC,EAAG;MACzDH,OAAO,CAACK,OAAO,GAAG,MAAM,CAAA;EAC1B,GAAA;IAEA,IAAK,CAAC,CAAC,OAAO,CAAC,CAACC,QAAQ,CAACH,IAAI,CAAC,EAAG;MAC/BC,oBAAoB,GAAMA,oBAAoB,GAAA,KAAA,GAAMF,MAAQ,CAAA;EAC9D,GAAA;IAEA,IAAKF,OAAO,CAACK,OAAO,EAAG;EACrB,IAAA,IAAKL,OAAO,CAACK,OAAO,KAAK,MAAM,IAAI,CAACT,gBAAgB,CAACU,QAAQ,CAACH,IAAI,CAAC,EAAG;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AA;EACR,SAAA;UACA,oBACEzC,cAAA,CAAA,QAAA,EAAA,QAAA,CAAA;EAAQ,UAAA,OAAO,EAAEoD,aAAAA;EAAc,SAAA,EAAK9K,KAAK,EAAA;YAAA,QACtCuI,EAAAA,SAAAA;WACM,CAAA,CAAA,CAAA;EAEb,OAAA;EAAC,KAAA,CAAA;KAEF,CAAA,CAAA;EAEP;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-cloudinary",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"main": "dist/next-cloudinary.umd.js",
|
|
5
5
|
"module": "dist/next-cloudinary.module.js",
|
|
6
6
|
"umd:main": "dist/next-cloudinary.umd.js",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "microbundle --no-compress --jsx React.createElement --jsxFragment React.Fragment --jsxImportSource react",
|
|
10
10
|
"dev": "microbundle watch --no-compress --jsx React.createElement --jsxFragment React.Fragment --jsxImportSource react",
|
|
11
|
-
"prepublishOnly": "cp ../README.md .",
|
|
11
|
+
"prepublishOnly": "cp ../README.md . && yarn build",
|
|
12
12
|
"postpublish": "rm ./README.md",
|
|
13
13
|
"test": "jest"
|
|
14
14
|
},
|
package/babel.config.js
DELETED
package/jest.config.js
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { constructCloudinaryUrl, getPublicId, createPlaceholderUrl } from '../../src/lib/cloudinary';
|
|
2
|
-
|
|
3
|
-
// Mock console.warn() so we can see when it's called
|
|
4
|
-
global.console = {
|
|
5
|
-
...global.console,
|
|
6
|
-
warn: jest.fn()
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
describe('Cloudinary', () => {
|
|
10
|
-
afterEach(() => {
|
|
11
|
-
// Clears the state of console.warn, in case multiple tests want to monitor it
|
|
12
|
-
jest.restoreAllMocks()
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
describe('constructCloudinaryUrl', () => {
|
|
16
|
-
it('should create a Cloudinary URL', () => {
|
|
17
|
-
const cloudName = 'customtestcloud';
|
|
18
|
-
const url = constructCloudinaryUrl({
|
|
19
|
-
options: {
|
|
20
|
-
src: 'turtle',
|
|
21
|
-
width: 100,
|
|
22
|
-
height: 100
|
|
23
|
-
},
|
|
24
|
-
config: {
|
|
25
|
-
cloud: {
|
|
26
|
-
cloudName
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
expect(url).toBe(`https://res.cloudinary.com/${cloudName}/image/upload/c_limit,w_100/f_auto/q_auto/turtle`);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('should create a Cloudinary URL with custom quality and format options', () => {
|
|
34
|
-
const format = 'png';
|
|
35
|
-
const quality = 75;
|
|
36
|
-
const cloudName = 'customtestcloud';
|
|
37
|
-
const url = constructCloudinaryUrl({
|
|
38
|
-
options: {
|
|
39
|
-
src: 'turtle',
|
|
40
|
-
width: 100,
|
|
41
|
-
height: 100,
|
|
42
|
-
format,
|
|
43
|
-
quality
|
|
44
|
-
},
|
|
45
|
-
config: {
|
|
46
|
-
cloud: {
|
|
47
|
-
cloudName
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
expect(url).toBe(`https://res.cloudinary.com/${cloudName}/image/upload/c_limit,w_100/f_${format}/q_${quality}/turtle`);
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
describe('getPublicId', () => {
|
|
56
|
-
it('Just returns a non-Cloudinary url', () => {
|
|
57
|
-
const src = 'https://google.com';
|
|
58
|
-
expect(getPublicId(src)).toBe(src)
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it('Just returns the public ID of a Cloudinary URL 1 folder deep', () => {
|
|
62
|
-
const publicId = 'turtle';
|
|
63
|
-
const src = `https://res.cloudinary.com/test-cloud/image/upload/c_limit,w_960/f_auto/q_auto/v1/${publicId}`;
|
|
64
|
-
expect(getPublicId(src)).toBe(publicId);
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it('Just returns the public ID of a Cloudinary URL 1 folder deep', () => {
|
|
68
|
-
const publicId = 'images/turtle';
|
|
69
|
-
const src = `https://res.cloudinary.com/test-cloud/image/upload/c_limit,w_960/f_auto/q_auto/v1/${publicId}`;
|
|
70
|
-
expect(getPublicId(src)).toBe(publicId);
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
it('Just returns the public ID of a Cloudinary URL 2 folders deep', () => {
|
|
74
|
-
const publicId = 'app/images/turtle';
|
|
75
|
-
const src = `https://res.cloudinary.com/test-cloud/image/upload/c_limit,w_960/f_auto/q_auto/v1/${publicId}`;
|
|
76
|
-
expect(getPublicId(src)).toBe(publicId);
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
it('Returns invalid Cloudinary url with a warning', () => {
|
|
80
|
-
const src = 'https://res.cloudinary.com';
|
|
81
|
-
expect(getPublicId(src)).toBe(src)
|
|
82
|
-
expect(console.warn)
|
|
83
|
-
.toBeCalledWith(`Not possible to retrieve the publicUrl from ${src}, make sure it's a valid cloudinary image url.`)
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
describe('createPlaceholderUrl', () => {
|
|
88
|
-
it('should create a placeholder URL with default settings', () => {
|
|
89
|
-
const cloudName = 'customtestcloud';
|
|
90
|
-
const url = createPlaceholderUrl({
|
|
91
|
-
src: 'turtle',
|
|
92
|
-
config: {
|
|
93
|
-
cloud: {
|
|
94
|
-
cloudName
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
expect(url).toBe(`https://res.cloudinary.com/${cloudName}/image/upload/c_limit,w_100/f_auto/q_1/turtle`);
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
it('should create a placeholder URL in grayscale', () => {
|
|
102
|
-
const cloudName = 'customtestcloud';
|
|
103
|
-
const url = createPlaceholderUrl({
|
|
104
|
-
src: 'turtle',
|
|
105
|
-
placeholder: 'grayscale',
|
|
106
|
-
config: {
|
|
107
|
-
cloud: {
|
|
108
|
-
cloudName
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
expect(url).toBe(`https://res.cloudinary.com/${cloudName}/image/upload/c_limit,w_100/e_grayscale/f_auto/q_1/turtle`);
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
it('should create a placeholder URL with a color', () => {
|
|
116
|
-
const cloudName = 'customtestcloud';
|
|
117
|
-
const url = createPlaceholderUrl({
|
|
118
|
-
src: 'turtle',
|
|
119
|
-
placeholder: 'color:blueviolet',
|
|
120
|
-
config: {
|
|
121
|
-
cloud: {
|
|
122
|
-
cloudName
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
expect(url).toBe(`https://res.cloudinary.com/${cloudName}/image/upload/c_limit,w_100/e_grayscale/e_colorize:60,co_blueviolet/f_auto/q_1/turtle`);
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
})
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { cloudinaryLoader } from '../../src/loaders/cloudinary-loader';
|
|
2
|
-
|
|
3
|
-
const cldConfig = {
|
|
4
|
-
cloud: {
|
|
5
|
-
cloudName: 'test-cloud'
|
|
6
|
-
},
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
describe('Cloudinary Loader', () => {
|
|
10
|
-
describe('cloudinaryLoader', () => {
|
|
11
|
-
it('should return a Cloudinary URL with basic features', async () => {
|
|
12
|
-
const imageProps = {
|
|
13
|
-
height: '600',
|
|
14
|
-
sizes: '100vw',
|
|
15
|
-
src: 'images/turtle',
|
|
16
|
-
width: '960',
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const options = {
|
|
20
|
-
quality: 75,
|
|
21
|
-
src: 'images/turtle',
|
|
22
|
-
width: 960,
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const cldOptions = {};
|
|
26
|
-
|
|
27
|
-
const result = cloudinaryLoader({ ...imageProps, options }, cldOptions, cldConfig);
|
|
28
|
-
|
|
29
|
-
expect(result).toBe('https://res.cloudinary.com/test-cloud/image/upload/c_limit,w_960/f_auto/q_auto/v1/images/turtle')
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it('should return a Cloudinary URL with advanced options', () => {
|
|
33
|
-
const imageProps = {
|
|
34
|
-
width: '987',
|
|
35
|
-
height: '1481',
|
|
36
|
-
src: 'images/woman-headphones',
|
|
37
|
-
sizes: '100vw',
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const options = {
|
|
41
|
-
src: 'images/woman-headphones',
|
|
42
|
-
width: 640
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const cldOptions = {
|
|
46
|
-
removeBackground: true,
|
|
47
|
-
crop: 'thumb',
|
|
48
|
-
gravity: 'faces',
|
|
49
|
-
tint: '40:253f8c',
|
|
50
|
-
underlays: [
|
|
51
|
-
{
|
|
52
|
-
publicId: 'images/city-skyline',
|
|
53
|
-
width: 987,
|
|
54
|
-
height: 987,
|
|
55
|
-
crop: 'fill'
|
|
56
|
-
}
|
|
57
|
-
]
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const result = cloudinaryLoader({ ...imageProps, options }, cldOptions);
|
|
61
|
-
|
|
62
|
-
expect(result).toBe('https://res.cloudinary.com/test-cloud/image/upload/e_background_removal/c_thumb,w_987,h_1481,g_faces/e_tint:40:253f8c/u_images:city-skyline,w_987,h_987,c_fill/fl_layer_apply,fl_no_overflow/f_auto/q_auto/v1/images/woman-headphones')
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it('should return a Cloudinary URL with fetch features', async () => {
|
|
66
|
-
const imageProps = {
|
|
67
|
-
height: '600',
|
|
68
|
-
sizes: '100vw',
|
|
69
|
-
src: 'https://upload.wikimedia.org/wikipedia/commons/4/44/Jelly_cc11.jpg',
|
|
70
|
-
width: '960',
|
|
71
|
-
deliveryType: 'fetch'
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const cldOptions = {};
|
|
75
|
-
|
|
76
|
-
const result = cloudinaryLoader(imageProps, cldOptions, cldConfig);
|
|
77
|
-
|
|
78
|
-
expect(result).toBe('https://res.cloudinary.com/test-cloud/image/fetch/c_limit,w_960/f_auto/q_auto/https://upload.wikimedia.org/wikipedia/commons/4/44/Jelly_cc11.jpg')
|
|
79
|
-
});
|
|
80
|
-
})
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { Cloudinary } from '@cloudinary/url-gen';
|
|
2
|
-
|
|
3
|
-
import * as croppingPlugin from '../../src/plugins/cropping';
|
|
4
|
-
|
|
5
|
-
const { plugin } = croppingPlugin
|
|
6
|
-
|
|
7
|
-
const cld = new Cloudinary({
|
|
8
|
-
cloud: {
|
|
9
|
-
cloudName: 'test-cloud-name'
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
const TEST_PUBLIC_ID = 'test-public-id';
|
|
14
|
-
|
|
15
|
-
describe('Cropping plugin', () => {
|
|
16
|
-
it('should apply a crop and gravity to a URL', () => {
|
|
17
|
-
const cldImage = cld.image(TEST_PUBLIC_ID);
|
|
18
|
-
const options = {
|
|
19
|
-
width: 100,
|
|
20
|
-
height: 100,
|
|
21
|
-
crop: 'crop',
|
|
22
|
-
gravity: 'auto'
|
|
23
|
-
};
|
|
24
|
-
plugin({ cldImage, options });
|
|
25
|
-
expect(cldImage.toURL()).toContain(`c_${options.crop},w_${options.width},h_${options.height},g_${options.gravity}/${TEST_PUBLIC_ID}`);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('should apply a gravity of auto by default if not set explicitly', () => {
|
|
29
|
-
const cldImage = cld.image(TEST_PUBLIC_ID);
|
|
30
|
-
const options = {
|
|
31
|
-
width: 100,
|
|
32
|
-
height: 100,
|
|
33
|
-
crop: 'fill'
|
|
34
|
-
};
|
|
35
|
-
plugin({ cldImage, options });
|
|
36
|
-
expect(cldImage.toURL()).toContain(`c_${options.crop},w_${options.width},h_${options.height},g_auto/${TEST_PUBLIC_ID}`);
|
|
37
|
-
});
|
|
38
|
-
});
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { Cloudinary } from '@cloudinary/url-gen';
|
|
2
|
-
|
|
3
|
-
import * as overlaysPlugin from '../../src/plugins/overlays';
|
|
4
|
-
|
|
5
|
-
const { plugin, DEFAULT_TEXT_OPTIONS } = overlaysPlugin
|
|
6
|
-
|
|
7
|
-
const cld = new Cloudinary({
|
|
8
|
-
cloud: {
|
|
9
|
-
cloudName: 'test-cloud-name'
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
const TEST_PUBLIC_ID = 'test-public-id';
|
|
14
|
-
|
|
15
|
-
describe('Plugins', () => {
|
|
16
|
-
describe('Text Overlays', () => {
|
|
17
|
-
it('should add a text overlay configured by overlay object', () => {
|
|
18
|
-
const cldImage = cld.image(TEST_PUBLIC_ID);
|
|
19
|
-
|
|
20
|
-
const color = 'white';
|
|
21
|
-
const fontFamily = 'Source Sans Pro';
|
|
22
|
-
const fontSize = 200;
|
|
23
|
-
const fontWeight = 'bold';
|
|
24
|
-
const text = 'Next Cloudinary';
|
|
25
|
-
|
|
26
|
-
const options = {
|
|
27
|
-
overlays: [{
|
|
28
|
-
text: {
|
|
29
|
-
color,
|
|
30
|
-
fontFamily,
|
|
31
|
-
fontSize,
|
|
32
|
-
fontWeight,
|
|
33
|
-
text
|
|
34
|
-
}
|
|
35
|
-
}]
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
plugin({
|
|
39
|
-
cldImage,
|
|
40
|
-
options
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
expect(cldImage.toURL()).toContain(`l_text:${encodeURIComponent(fontFamily)}_${fontSize}_${fontWeight}:${encodeURIComponent(text)},co_${color}/fl_layer_apply,fl_no_overflow/${TEST_PUBLIC_ID}`);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it('should add a text overlay by overlay object text string', () => {
|
|
48
|
-
const cldImage = cld.image(TEST_PUBLIC_ID);
|
|
49
|
-
|
|
50
|
-
const { color, fontFamily, fontSize, fontWeight } = DEFAULT_TEXT_OPTIONS;
|
|
51
|
-
const text = 'Next Cloudinary';
|
|
52
|
-
|
|
53
|
-
const options = {
|
|
54
|
-
overlays: [{
|
|
55
|
-
text
|
|
56
|
-
}]
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
plugin({
|
|
60
|
-
cldImage,
|
|
61
|
-
options
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
expect(cldImage.toURL()).toContain(`l_text:${encodeURIComponent(fontFamily)}_${fontSize}_${fontWeight}:${encodeURIComponent(text)},co_${color}/fl_layer_apply,fl_no_overflow/${TEST_PUBLIC_ID}`);
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it('should add a text overlay by text string', () => {
|
|
68
|
-
const cldImage = cld.image(TEST_PUBLIC_ID);
|
|
69
|
-
|
|
70
|
-
const { color, fontFamily, fontSize, fontWeight } = DEFAULT_TEXT_OPTIONS;
|
|
71
|
-
const text = 'Next Cloudinary';
|
|
72
|
-
|
|
73
|
-
const options = {
|
|
74
|
-
text
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
plugin({
|
|
78
|
-
cldImage,
|
|
79
|
-
options
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
expect(cldImage.toURL()).toContain(`l_text:${encodeURIComponent(fontFamily)}_${fontSize}_${fontWeight}:${encodeURIComponent(text)},co_${color}/fl_layer_apply,fl_no_overflow/${TEST_PUBLIC_ID}`);
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it('should add a text overlay by text object', () => {
|
|
86
|
-
const cldImage = cld.image(TEST_PUBLIC_ID);
|
|
87
|
-
|
|
88
|
-
const color = 'white';
|
|
89
|
-
const fontFamily = 'Source Sans Pro';
|
|
90
|
-
const fontSize = 200;
|
|
91
|
-
const fontWeight = 'bold';
|
|
92
|
-
const text = 'Next Cloudinary';
|
|
93
|
-
|
|
94
|
-
const options = {
|
|
95
|
-
text: {
|
|
96
|
-
color,
|
|
97
|
-
fontFamily,
|
|
98
|
-
fontSize,
|
|
99
|
-
fontWeight,
|
|
100
|
-
text
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
plugin({
|
|
105
|
-
cldImage,
|
|
106
|
-
options
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
expect(cldImage.toURL()).toContain(`l_text:${encodeURIComponent(fontFamily)}_${fontSize}_${fontWeight}:${encodeURIComponent(text)},co_${color}/fl_layer_apply,fl_no_overflow/${TEST_PUBLIC_ID}`);
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
});
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { Cloudinary } from '@cloudinary/url-gen';
|
|
2
|
-
|
|
3
|
-
import * as rawTransformationsPlugin from '../../src/plugins/raw-transformations';
|
|
4
|
-
|
|
5
|
-
const { plugin } = rawTransformationsPlugin
|
|
6
|
-
|
|
7
|
-
const cld = new Cloudinary({
|
|
8
|
-
cloud: {
|
|
9
|
-
cloudName: 'test-cloud-name'
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
const TEST_PUBLIC_ID = 'test-public-id';
|
|
14
|
-
|
|
15
|
-
describe('Plugins', () => {
|
|
16
|
-
describe('Raw Transformations', () => {
|
|
17
|
-
it('should apply a single raw transformations to the end of a Cloudinary URL', () => {
|
|
18
|
-
|
|
19
|
-
const cldImage = cld.image(TEST_PUBLIC_ID);
|
|
20
|
-
|
|
21
|
-
const options = {
|
|
22
|
-
rawTransformations: [
|
|
23
|
-
'e_blur:2000'
|
|
24
|
-
]
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
plugin({
|
|
28
|
-
cldImage,
|
|
29
|
-
options
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
expect(cldImage.toURL()).toContain(`${options.rawTransformations.join('/')}/${TEST_PUBLIC_ID}`);
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('should apply an array of raw transformations to the end of a Cloudinary URL', () => {
|
|
36
|
-
|
|
37
|
-
const cldImage = cld.image(TEST_PUBLIC_ID);
|
|
38
|
-
|
|
39
|
-
const options = {
|
|
40
|
-
rawTransformations: [
|
|
41
|
-
'e_blur:2000',
|
|
42
|
-
'e_tint:100:0000FF:0p:FF1493:100p'
|
|
43
|
-
]
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
plugin({
|
|
47
|
-
cldImage,
|
|
48
|
-
options
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
expect(cldImage.toURL()).toContain(`${options.rawTransformations.join('/')}/${TEST_PUBLIC_ID}`);
|
|
52
|
-
})
|
|
53
|
-
});
|
|
54
|
-
});
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { Cloudinary } from '@cloudinary/url-gen';
|
|
2
|
-
|
|
3
|
-
import * as underlaysPlugin from '../../src/plugins/underlays';
|
|
4
|
-
|
|
5
|
-
const { plugin, DEFAULT_TEXT_OPTIONS } = underlaysPlugin
|
|
6
|
-
|
|
7
|
-
const cld = new Cloudinary({
|
|
8
|
-
cloud: {
|
|
9
|
-
cloudName: 'test-cloud-name'
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
const TEST_PUBLIC_ID = 'test-public-id';
|
|
14
|
-
|
|
15
|
-
describe('Plugins', () => {
|
|
16
|
-
describe('Underlays', () => {
|
|
17
|
-
it('should add an underlay configured by object', () => {
|
|
18
|
-
const cldImage = cld.image(TEST_PUBLIC_ID);
|
|
19
|
-
|
|
20
|
-
const publicId = 'images/galaxy';
|
|
21
|
-
const width = 1920;
|
|
22
|
-
const height = 1200;
|
|
23
|
-
const crop = 'fill';
|
|
24
|
-
|
|
25
|
-
const options = {
|
|
26
|
-
underlays: [{
|
|
27
|
-
publicId,
|
|
28
|
-
width,
|
|
29
|
-
height,
|
|
30
|
-
crop,
|
|
31
|
-
}]
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
plugin({
|
|
35
|
-
cldImage,
|
|
36
|
-
options
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
expect(cldImage.toURL()).toContain(`u_${publicId.replace(/\//g, ':')},w_${width},h_${height},c_${crop}/fl_layer_apply,fl_no_overflow/${TEST_PUBLIC_ID}`);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it('should add an underlay by string', () => {
|
|
43
|
-
const cldImage = cld.image(TEST_PUBLIC_ID);
|
|
44
|
-
|
|
45
|
-
const publicId = 'images/galaxy';
|
|
46
|
-
const width = 1920;
|
|
47
|
-
const height = 1200;
|
|
48
|
-
const crop = 'fill';
|
|
49
|
-
|
|
50
|
-
const options = {
|
|
51
|
-
underlay: publicId
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
plugin({
|
|
55
|
-
cldImage,
|
|
56
|
-
options
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
expect(cldImage.toURL()).toContain(`u_${publicId.replace(/\//g, ':')},c_${crop}/fl_layer_apply,fl_no_overflow/${TEST_PUBLIC_ID}`);
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
});
|