Cloudinary Different Public Id When Uploading Multiple Images

Cloudinary offers a multifariousness of avant-garde URL options for delivering your media assets.

  • Asset versions
  • Error handling
  • Client-side asset lists
  • Individual CDNs and CNAMEs
  • Multi-CDN Solutions
  • Multiple sub-domains
  • SEO-friendly media asset URLs
  • Using a default prototype placeholder
  • Generating delivery URL signatures

Asset versions

Past default, Cloudinary assigns a randomly generated unique public ID to each uploaded media asset. Alternatively, you lot tin can either define your own custom public ID or one based on the original file name of the uploaded image. If you lot upload an image with a public ID that already exists, the file volition be overwritten. Go on in mind though that the CDN may already contain a previously cached copy of the older epitome.

To force the CDN to display the latest uploaded image, you tin can add a version component to Cloudinary's URLs. The version value is returned by Cloudinary as function of the response of the image upload, and represents the timestamp of the upload. Adding the version component to URLs can be done by setting the version parameter (v in URLs), for example:

Cerise (cloudinary 1.ten):

Copy to clipboard

cl_image_tag(                    "                    sample.jpg                    "                  )

PHP (cloudinary_php 2.x):

Copy to clipboard

(new                  ImageTag(                    '                    sample.jpg                    '                  ))   ->version(                    "                    v1312461204                    "                  );

PHP (cloudinary_php one.x (legacy)):

Re-create to clipboard

cl_image_tag(                    "                    sample.jpg                    "                  )

Python (cloudinary one.ten):

Copy to clipboard

CloudinaryImage(                    "                    sample.jpg                    "                  ).image()

Node.js (cloudinary one.10):

Copy to clipboard

cloudinary.image(                    "                    sample.jpg                    "                  )

Coffee (cloudinary 1.x):

Copy to clipboard

cloudinary.url().transformation(new                  Transformation().imageTag(                    "                    sample.jpg                    "                  );

JS (@cloudinary/url-gen 1.10):

Re-create to clipboard

                  new                  CloudinaryImage(                    "                    sample.jpg                    "                  ).version(                    "                    v1312461204                    "                  );

JS (cloudinary-cadre ii.10 (legacy)):

Copy to clipboard

cloudinary.imageTag(                    '                    sample.jpg                    '                  ).toHtml();

jQuery (cloudinary-jquery 2.x):

Re-create to clipboard

                  $.cloudinary.image(                    "                    sample.jpg                    "                  )

React (@cloudinary/react 1.10):

Re-create to clipboard

                    new                  CloudinaryImage(                    "                    sample.jpg                    "                  ).version(                    "                    v1312461204                    "                  );

React (cloudinary-react ane.x):

Copy to clipboard

                  <Epitome                  publicId=                    "                    sample.jpg                    "                                    >                  </Image>                

Vue.js (cloudinary-vue i.x):

Re-create to clipboard

<cld-image                  public-id=                    "                    sample.jpg                    "                                    >  <                    /                    cld-image>                                  

Angular (@cloudinary/ng 1.10):

Copy to clipboard

                    new                  CloudinaryImage(                    "                    sample.jpg                    "                  ).version(                    "                    v1312461204                    "                  );

Athwart (@cloudinary/angular-5.x ane.10 (legacy)):

Re-create to clipboard

<cl-epitome                  public-id=                    "                    sample.jpg                    "                                    >  <                    /                    cl-image>                                  

.Internet (CloudinaryDotNet 1.x):

Copy to clipboard

cloudinary.Api.UrlImgUp.BuildImageTag(                    "                    sample.jpg                    "                  )

iOS (cloudinary 3.x):

Copy to clipboard

imageView.cldSetImage(cloudinary.createUrl().generate(                    "                    sample.jpg                    "                  )!, cloudinary: cloudinary)

Android (cloudinary-android 1.x):

Copy to clipboard

MediaManager.go().url().transformation(new                  Transformation().generate(                    "                    sample.jpg                    "                  );

Kotlin (kotlin-url-gen 1.10):

Copy to clipboard

cloudinary.epitome {   publicId(                    "                    sample.jpg                    "                  )    version(                    "                    v1312461204                    "                  )  }.generate()

sample image with version

Every bit an culling to using versions, you can gear up the invalidate parameter to true while uploading a new image in order to invalidate the previous image throughout the CDN. Information technology usually takes betwixt a few seconds and a few minutes for the invalidation to fully propagate through the CDN, while the version component takes result immediately.

  • There are also a number of other important considerations when using the invalidate functionality. For case, if there is no version number in a URL that includes a binder structure, so by default, those URLs are not invalidated. For details on invalidating media assets, come across Invalidating cached media assets on the CDN.
  • You cannot use 'v' followed past numeric characters as the name of a folder.

Error handling

If you have a problem when accessing a Cloudinary transformation URL (e.g., a bare effect in your browser), it might be a simple matter of using the wrong transformation syntax. To understand more than, check the X-Cld-Error HTTP response header which is where Cloudinary reports whatever errors information technology encounters (e.grand., invalid syntax, invalid parameters, limit problems, etc.).

For example, trying to access the following URL would effect in a X-Cld-Error: Invalid width - abc fault, as the width parameter is used with an integer value and not a string:

https://res.cloudinary.com/demo/paradigm/upload/w_abc/sample.jpg

To view the X-Cld-Error header on a Chrome browser for example, select Developers Tools from the View bill of fare. Then select the Network tab, refresh your page, click on the image name with the 400 status code and await for 10-Cld-Error under Response Headers.

Error written report

You tin can also use the Management Console to see errors that have been generated from requests to your account via delivery URLs or API calls. To admission the Error Report folio click Reports > Error report.

Error report

You tin export an error report for a specific twenty-four hour period past selecting the appointment and clicking the Export to CSV link. An email is sent to you with a link to download the mistake report in CSV format.

Customer-side asset lists

Y'all can utilize the listing delivery blazon to generate a JSON listing of all assets with a specified tag direct from your forepart-end lawmaking. Additional information is returned for each asset, including information on its format, type, dimensions, contextual metadata and structured metadata.

URL syntax:

Copy to clipboard

https://res.cloudinary.com/<your_cloud_name>/<resource_type>/listing/<tag>.json

The response is a JSON snippet listing all the resources of the specified resource type and the specified tag. For case, the asking below generates a JSON list of all prototype resources in the demo project with the tag logo.

Copy to clipboard

https://res.cloudinary.com/demo/image/list/logo.json

To generate the client-side lists using an SDK:

Cerise (cloudinary 1.10):

Re-create to clipboard

cloudinary_url(                    "                    logo.json                    "                  ,                  :type=>                    "                    listing                    "                  )

PHP (cloudinary_php ii.x):

Copy to clipboard

                  Media::fromParams(                    "                    logo.json                    "                  , [                    "                    blazon                    "                  =>                    "                    list                    "                  ]);

PHP (cloudinary_php 1.10 (legacy)):

Copy to clipboard

cloudinary_url(                    "                    logo.json                    "                  , [                    "                    blazon                    "                  =>                    "                    list                    "                  ])

Python (cloudinary ane.ten):

Copy to clipboard

cloudinary_url(                    "                    logo.json                    "                  , type=                    "                    listing                    "                  )

Node.js (cloudinary 1.ten):

Copy to clipboard

cloudinary.url(                    "                    logo.json                    "                  , {type:                                      "                    listing                    "                  })

Java (cloudinary ane.x):

Copy to clipboard

cloudinary.url().type(                    "                    listing                    "                  ).generate(                    "                    logo.json                    "                  );

JS (cloudinary-core 2.x (legacy)):

Copy to clipboard

cloudinary.url(                    '                    logo.json                    '                  , {type:                                      "                    listing                    "                  });

jQuery (cloudinary-jquery 2.x):

Copy to clipboard

                  $.cloudinary.url(                    "                    logo.json                    "                  , {type:                                      "                    list                    "                  })

.Net (CloudinaryDotNet one.x):

Copy to clipboard

cloudinary.Api.UrlImgUp.Type(                    "                    list                    "                  ).BuildImageTag(                    "                    logo.json                    "                  )

iOS (cloudinary three.x):

Copy to clipboard

imageView.cldSetImage(cloudinary.createUrl().setType(                                      "                    list                    "                  ).generate(                    "                    logo.json                    "                  )!, cloudinary: cloudinary)

Android (cloudinary-android 1.x):

Copy to clipboard

MediaManager.get().url().type(                    "                    listing                    "                  ).generate(                    "                    logo.json                    "                  );

Go (cloudinary-become 1.x):

Copy to clipboard

myList, err := cld.Media(                    "                    logo.json                    "                  ) myList.DeliveryType =                                      "                    list                    "                                    url, err := myList.Cord()

JSON response from the URL:

Copy to clipboard

              {                "                resources                "              :    [{                "                public_id                "              :                "                cloudinary_fashion_logo                "              ,                "                version                "              :1588962712,                "                format                "              :                "                png                "              ,                              "                width                "              :240,                "                height                "              :307,                "                blazon                "              :                "                upload                "              ,                "                created_at                "              :                "                2020-05-08T18:31:52Z                "              ,                              "                metadata                "              :[{                "                external_id                "              :                "                color_id                "              ,                "                characterization                "              :                "                Colors                "              ,                "                type                "              :                "                set                "              ,                "                value                "              :      [{                "                external_id                "              :                "                color1                "              ,                "                value                "              :                "                red                "              },{                "                external_id                "              :                "                color2                "              ,                "                value                "              :                "                green                "              }]}]},    {                "                public_id                "              :                "                amazon_logo                "              ,                "                version                "              :1315740184,                "                format                "              :                "                png                "              ,                              "                width                "              :162,                "                height                "              :38,                "                blazon                "              :                "                upload                "              ,                "                created_at                "              :                "                2011-09-11T11:23:04Z                "              },    {                "                public_id                "              :                "                microsoft_logo                "              ,                "                version                "              :1315740090,                "                format                "              :                "                png                "              ,                              "                width                "              :216,                "                height                "              :seventy,                "                type                "              :                "                upload                "              ,                "                created_at                "              :                "                2011-09-11T11:21:30Z                "              },    {                "                public_id                "              :                "                apple_logo                "              ,                "                version                "              :1315740074,                "                format                "              :                "                jpg                "              ,                              "                width                "              :206,                "                top                "              :250,                "                type                "              :                "                upload                "              ,                "                created_at                "              :                "                2011-09-11T11:21:14Z                "              ,                              "                context                "              :{                "                custom                "              :{                "                Main                "              :                "                true                "              ,                "                Order                "              :                "                2                "              }}},    {                "                public_id                "              :                "                google_logo                "              ,                "                version                "              :1315740052,                "                format                "              :                "                png                "              ,                              "                width                "              :275,                "                summit                "              :95,                "                type                "              :                "                upload                "              ,                "                created_at                "              :                "                2011-09-11T11:20:52Z                "              ,                              "                context                "              :{                "                custom                "              :{                "                alt                "              :                "                google logo                "              ,                "                explanation                "              :                "                Google Logo                "              }}}],                              "                updated_at                "              :                "                2020-05-08T21:11:37Z                "              }
  • By default, the listing delivery type is restricted. To enable information technology, open the Security settings in your Direction panel, and articulate Resources listing item nether Restricted prototype types. You may desire to articulate this choice only temporarily, as needed. Alternatively, you can bypass this (and whatsoever) delivery type restriction using a signed URL.
  • This option supports listing up to g resources. To retrieve more than 1000, use the resources_by_tag property of the Admin API in server-side code, and include the next_cursor parameter to view long lists.
  • The JSON response is cached with a 60 2nd expiration policy. If yous add or remove tags to avails, you'll be able to retrieve an updated JSON one infinitesimal later on the previous JSON was generated.

Private CDNs and CNAMEs

The default Cloudinary shared CDN distribution is https://res.cloudinary.com. Thus the default delivery URL for Cloudinary accounts uses the format:

https://res.cloudinary.com/<cloud_name>/...

Cloudinary also supports individual CDN distribution configurations. In this case, your asset delivery URL will follow the format:

https://<cloud_name>-res.cloudinary.com/...

For instance:

https://demo-res.cloudinary.com/image/upload/sample.jpg

Additionally, Cloudinary supports defining custom CNAMEs for relevant customers. In this case, your asset delivery URL will follow the format:

https://<your custom domain name>/...

For example:

https://www.example.com/image/upload/sample.jpg

Private CDN distributions and CNAMEs are available only for Cloudinary's Advanced plan and higher, and crave a pocket-size setup on Cloudinary'southward side. An HTTPS-enabled CNAME also entails an additional cost. Contact us for more details.

SDK configuration for individual CDNs and CNAMES

By default, when you use Cloudinary SDKs to generate commitment or transformation URLs, they generate them in the default format.

If you are using a private CDN or CNAME, make sure to ascertain the private_cdn or secure_distribution/cname configuration parameter, so that the SDK will generate your URLs correctly.

For details, encounter Configuration parameters besides equally the Installation and Configuration section of the relevant SDK guide.

Custom favicons

If your business relationship is configured with a private CDN or CNAME, you can too set upward a custom favicon for your business relationship. This favicon will be displayed whenever anyone views the assets you evangelize in a separate tab. For example, note the custom Custom favicon logo in the browser tab of the following image:

To set up your business relationship'southward custom favicon, upload a public .ico file called favicon.ico to the root folder of your account.

If you don't set a custom favicon for your account:

  • For accounts with private CDN configurations, the default Cloudinary logo favicon will be used.
  • For CNAME accounts, no favicon will be displayed.

Multi-CDN Solutions

Different CDN solutions may provide better back up for a particular CDN-based functionality that is important for your website or application, such as quick invalidations, video streaming capabilities, and more than.

Alternatively, you may find that i CDN service best serves sure geographical markets, while another is significantly better for other locations. The same may be truthful for the same geography, but at unlike times of the day, or for a diversity of other variables. Therefore, you could potentially optimize your page load time for each user past using different CDN services for different user requests.

If your business relationship is on an Enterprise plan, you lot tin optionally take advantage of i of the following solutions to ensure that your resources are delivered via the CDN that bests fits the needs of your application and your users:

  • Dynamic multi-CDN switching: Uses real-time data to automatically select the best performing or nearly appropriate of the supported CDN services for every user asking. This automated CDN switching service routes users based on geography, HTTP round-trip-fourth dimension (RTT), and a variety of other variables, and directs each user to a specific web server based on intersections between server load and geography, while avoiding CDNs that are experiencing temporary outages or lowered availability. It gathers this data on an ongoing basis then that it is gear up to make the best real-time routing decision each fourth dimension a request comes in.

    • Take a look at the Multi-CDN Demo folio to meet how long the same resource takes to deliver to your browser or to a diversity of geographies via unlike CDN services, and how quickly you can deliver that aforementioned resources via the multi-CDN switching characteristic.
    • This service includes real-time monitoring that can provide insights about how improvements in your page load fourth dimension influence user behavior KPIs such as visit length and conversions.
  • Smart CDN pick: Cloudinary experts help you make up one's mind which of the supported CDN services is the best fit for your required features and target audition. In some cases, it may even be adamant that certain types of resources should be delivered through one CDN service, and the remainder through some other. Additionally, if it'south adamant in the future that another CDN service could better serve your content, Cloudinary transparently implements the new configuration and mapping behind the scenes.

In both of the to a higher place options, Cloudinary handles the required CDN configurations and the mappings betwixt CDN domains and the public Cloudinary domain, so that the resource URLs in your site or app never demand to change.

These multi-CDN features are available only to Cloudinary customers with Enterprise programme accounts, and the dynamic multi-CDN switching feature affects pricing. These features are currently supported for Akamai, Fastly and CloudFront CDNs. Contact united states of america for additional details.

Multiple sub-domains

The multiple sub-domains feature is no longer necessary with Cloudinary supporting the newer HTTP 2.0 protocol, since HTTP 2.0 supports concurrency past default.

Browsers currently limit the number of download requests they perform concurrently from each unique domain, which means that downloading many images from a single web page might exist somewhat tedious. To overcome this limitation, Cloudinary supports downloading images via multiple sub-domains, which means yous can spread your paradigm downloads between the different sub-domains, resulting in a much improved web browsing speed.

The improvement applies just to image requests over HTTP and information technology is not recommended to use multiple sub-domains together with HTTPS: opening an HTTPS connectedness requires more fourth dimension than opening an HTTP connection (several round trips are needed to perform the encryption handshake).

Cloudinary supports the default res sub-domain, likewise every bit the res-ane through res-v sub-domains, as a prefix to the host name. Mapping between a specific image (by public ID) and the six different sub-domains (res plus res-1 through res-5) should be consistent in order to ensure that the browsers can correctly cache the images. For example, referencing a sure image one time via 'res-i' and then once more via 'res-2' will bypass browser caching and download the image twice.

For example, the sample image delivered via the res-four sub-domain:

https://res-4.cloudinary.com/demo/paradigm/upload/sample.jpg

When using one of Cloudinary's framework SDKs, you can besides automatically enable delivering images from the res-1 through res-5 sub-domains by setting the cdn_subdomain parameter to true, either globally (due east.g., in the CLOUDINARY_URL surround variable) or locally in each call. Note that the Cloudinary SDKs automatically map individual images consistently to the same sub-domain using a CRC32 based code of the image's public ID.

You lot can also use multiple sub-domains when using a custom domain (CNAME) past prepending the a1 through a5 sub-domains, as a prefix to the host proper name, for example:

https://a1.<mydomain.com>/image/upload/sample.jpg

CNAMEs are bachelor only for Cloudinary'southward Advanced programme and college, and requires a small-scale setup on Cloudinary's side. Furthermore, the sub-domains demand to be defined in the DNS settings of the domain name. Contact us for more details.

For more information on using sub-domains, see the Reduce site load fourth dimension with multiple CDN sub-domains article.

SEO-friendly media asset URLs

Image and video URLs are specified in the source code of HTML pages and are leveraged by search engines to understand the media asset's content. Concise and descriptive image and video file names are better for search engines to excerpt information about a media file, therefore supporting your site'south SEO ranking.

SEO starts with the power to define custom public IDs while uploading media assets which can exist as descriptive as necessary. Cloudinary tin can help make your image and video URLs more than SEO friendly in a few other ways:

  • Root path URLs
  • Dynamic SEO suffixes
  • CNAMEs

For more information on creating SEO friendly URLs, run into the article on How to dynamically create SEO-friendly URLs for your site'southward images.

Root path URLs

The Root Path URL feature allows yous to create shorter epitome URLs for delivering uploaded images. The default Cloudinary resource commitment URL includes the resource type and type parameters, for case, /image/upload. With Cloudinary'southward Root Path URL feature, the resource blazon and type parameters are set up to the default values 'image' and 'upload' respectively, which means that any URL without the resource type and type parameters will automatically default to using those values.

For example, the default delivery URL for the sample image in JPEG format is normally:

https://res.cloudinary.com/demo/image/upload/sample.jpg

The commitment URL using the Root Path URL feature for image uploads is:

https://res.cloudinary.com/demo/sample.jpg

Both the URLs above evangelize the same uploaded image.

Dynamic SEO suffixes

The dynamic SEO suffixes characteristic allows you lot to dynamically add a descriptive suffix to the Public ID in the commitment URL. This can exist useful:

  • If the asset was not given a suitable Public ID during the upload process.
  • To support different languages for describing a single asset.
  • To reflect specific content on certain pages.

Using this characteristic when delivering a URL does non incur boosted transformation counts as the suffix is resolved on the CDN layer.

Even when transformations are practical, if you deliver the identical transformation URL multiple times, where only the SEO suffix differs, then only the offset delivered (or eagerly generated) of those URLs, regardless of SEO suffix, is charged for initially generating the transformed asset.

To add a dynamic SEO suffix, the nugget type and delivery blazon elements of the URL need to exist merged into a unmarried component:

  • For assets stored using the upload delivery type:
    • replace /image/upload with /images
    • replace /video/upload with /videos
    • replace /raw/upload with /files
  • For private image uploads, replace /epitome/individual with /private_images
  • For authenticated image uploads, replace image/authenticated with /authenticated_images.

Afterwards, whatsoever custom suffix tin then be dynamically appended to the Public ID past adding a slash (/) and the SEO name.

Currently, private and authenticated videos do not support SEO suffixes.

For example the default delivery URL for the t8sn7wg4jd74j epitome in JPEG format is:

https://demo-res.cloudinary.com/image/upload/t8sn7wg4jd74j.jpg

The delivery URL with the suffix basketball-game added to the Public ID is:

https://demo-res.cloudinary.com/images/t8sn7wg4jd74j/basketball-game.jpg

In the URL below, the same image is given a suffix in Spanish:

https://demo-res.cloudinary.com/images/t8sn7wg4jd74j/baloncesto-juego.jpg

All the URLs above deliver the same uploaded image.

Generating URLs with SEO suffixes using SDKs

To generate a URL with an SEO suffix using an SDK, pass the relevant url_suffix/suffix configuration parameter. The SDK will then generate the URL with correct merged asset type & commitment type component and suspend the specified suffix.

The instance beneath shows a URL with multiple chained transformations and a Spanish SEO suffix.

Ruby (cloudinary one.x):

Copy to clipboard

cl_image_tag(                    "                    t8sn7wg4jd74j.jpg                    "                  ,                  :url_suffix=>                    "                    baloncesto-juego                    "                  ,                  :transformation=>[   {:aspect_ratio=>                    "                    i.0                    "                  ,                  :gravity=>                    "                    face up                    "                  ,                  :width=>0.6,                  :zoom=>0.vii,                  :crop=>                    "                    thumb                    "                  },   {:radius=>                    "                    max                    "                  },   {:color=>                    "                    brown                    "                  ,                  :outcome=>                    "                    outline                    "                  }   ])

PHP (cloudinary_php 2.ten):

Copy to clipboard

(new                  ImageTag(                    '                    t8sn7wg4jd74j.jpg                    '                  ))   ->resize(Resize::thumbnail()->width(0.half dozen) ->aspectRatio(i.0) ->zoom(0.7)   ->gravity(                  Gravity::focusOn(                  FocusOn::confront()))   )   ->roundCorners(RoundCorners::max())   ->effect(Issue::outline()   ->colour(Color::BROWN)   )   ->suffix(                    "                    baloncesto-juego                    "                  );

PHP (cloudinary_php 1.x (legacy)):

Copy to clipboard

cl_image_tag(                    "                    t8sn7wg4jd74j.jpg                    "                  ,                  assortment(                    "                    url_suffix                    "                  =>                    "                    baloncesto-juego                    "                  ,                                      "                    transformation                    "                  =>assortment(                  array(                    "                    aspect_ratio                    "                  =>                    "                    i.0                    "                  ,                                      "                    gravity                    "                  =>                    "                    face                    "                  ,                                      "                    width                    "                  =>                    "                    0.6                    "                  ,                                      "                    zoom                    "                  =>                    "                    0.7                    "                  ,                                      "                    crop                    "                  =>                    "                    thumb                    "                  ),                  array(                    "                    radius                    "                  =>                    "                    max                    "                  ),                  array(                    "                    colour                    "                  =>                    "                    brown                    "                  ,                                      "                    result                    "                  =>                    "                    outline                    "                  )   )))

Python (cloudinary i.x):

Copy to clipboard

CloudinaryImage(                    "                    t8sn7wg4jd74j.jpg                    "                  ).paradigm(url_suffix=                    "                    baloncesto-juego                    "                  , transformation=[   {                    '                    aspect_ratio                    '                  :                                      "                    1.0                    "                  ,                                      '                    gravity                    '                  :                                      "                    confront                    "                  ,                                      '                    width                    '                  :                                      "                    0.6                    "                  ,                                      '                    zoom                    '                  :                                      "                    0.7                    "                  ,                                      '                    crop                    '                  :                                      "                    pollex                    "                  },   {                    '                    radius                    '                  :                                      "                    max                    "                  },   {                    '                    color                    '                  :                                      "                    brown                    "                  ,                                      '                    effect                    '                  :                                      "                    outline                    "                  }   ])

Node.js (cloudinary 1.x):

Copy to clipboard

cloudinary.image(                    "                    t8sn7wg4jd74j.jpg                    "                  , {url_suffix:                                      "                    baloncesto-juego                    "                  ,                  transformation: [   {aspect_ratio:                                      "                    1.0                    "                  ,                  gravity:                                      "                    face                    "                  ,                  width:                                      "                    0.half dozen                    "                  ,                  zoom:                                      "                    0.7                    "                  ,                  crop:                                      "                    thumb                    "                  },   {radius:                                      "                    max                    "                  },   {color:                                      "                    brown                    "                  ,                  event:                                      "                    outline                    "                  }   ]})

Coffee (cloudinary 1.x):

Re-create to clipboard

cloudinary.url().transformation(new                  Transformation()   .aspectRatio(                    "                    1.0                    "                  ).gravity(                    "                    face                    "                  ).width(0.6).zoom(0.7).ingather(                    "                    pollex                    "                  ).chain()   .radius(                    "                    max                    "                  ).chain()   .color(                    "                    brown                    "                  ).effect(                    "                    outline                    "                  )).suffix(                    "                    baloncesto-juego                    "                  ).imageTag(                    "                    t8sn7wg4jd74j.jpg                    "                  );

JS (@cloudinary/url-gen one.x):

JS (cloudinary-core 2.x (legacy)):

Copy to clipboard

cloudinary.imageTag(                    '                    t8sn7wg4jd74j.jpg                    '                  , {urlSuffix:                                      "                    baloncesto-juego                    "                  ,                  transformation: [   {aspectRatio:                                      "                    1.0                    "                  ,                  gravity:                                      "                    confront                    "                  ,                  width:                                      "                    0.half-dozen                    "                  ,                  zoom:                                      "                    0.seven                    "                  ,                  ingather:                                      "                    thumb                    "                  },   {radius:                                      "                    max                    "                  },   {color:                                      "                    brown                    "                  ,                  effect:                                      "                    outline                    "                  }   ]}).toHtml();

jQuery (cloudinary-jquery 2.x):

Copy to clipboard

                  $.cloudinary.image(                    "                    t8sn7wg4jd74j.jpg                    "                  , {url_suffix:                                      "                    baloncesto-juego                    "                  ,                  transformation: [   {aspect_ratio:                                      "                    i.0                    "                  ,                  gravity:                                      "                    face up                    "                  ,                  width:                                      "                    0.half-dozen                    "                  ,                  zoom:                                      "                    0.7                    "                  ,                  ingather:                                      "                    thumb                    "                  },   {radius:                                      "                    max                    "                  },   {color:                                      "                    brown                    "                  ,                  effect:                                      "                    outline                    "                  }   ]})

React (@cloudinary/react 1.ten):

React (cloudinary-react 1.x):

Copy to clipboard

                  <Image                  publicId=                    "                    t8sn7wg4jd74j.jpg                    "                                    urlSuffix=                    "                    baloncesto-juego                    "                                    >                  <Transformation                  aspectRatio=                    "                    ane.0                    "                                    gravity=                    "                    face                    "                                    width=                    "                    0.6                    "                                    zoom=                    "                    0.vii                    "                                    ingather=                    "                    pollex                    "                                    />                  <Transformation                  radius=                    "                    max                    "                                    />                  <Transformation                  color=                    "                    brown                    "                                    effect=                    "                    outline                    "                                    />                  </Image>                

Vue.js (cloudinary-vue 1.x):

Copy to clipboard

<cld-image                  public-id=                    "                    t8sn7wg4jd74j.jpg                    "                                    url-suffix=                    "                    baloncesto-juego                    "                  >                  <cld-transformation                  attribute-ratio=                    "                    1.0                    "                                    gravity=                    "                    face                    "                                    width=                    "                    0.vi                    "                                    zoom=                    "                    0.7                    "                                    crop=                    "                    thumb                    "                                    />                  <cld-transformation                  radius=                    "                    max                    "                                    />                  <cld-transformation                  color=                    "                    brownish                    "                                    consequence=                    "                    outline                    "                                    />                  <                    /                    cld-image>                                  

Athwart (@cloudinary/ng 1.10):

Angular (@cloudinary/angular-5.x i.x (legacy)):

Copy to clipboard

<cl-paradigm                  public-id=                    "                    t8sn7wg4jd74j.jpg                    "                                    url-suffix=                    "                    baloncesto-juego                    "                  >   <cl-transformation attribute-ratio=                    "                    i.0                    "                                    gravity=                    "                    face                    "                                    width=                    "                    0.6                    "                                    zoom=                    "                    0.vii                    "                                    ingather=                    "                    pollex                    "                  >   <                    /                    cl-transformation>                                                                              <cl-transformation radius="max">                                                                              <                    /                  cl-transformation>   <cl-transformation color=                    "                    chocolate-brown                    "                                    event=                    "                    outline                    "                  >   <                    /                    cl-transformation>                                                        <                    /                  cl-image>

.Internet (CloudinaryDotNet 1.x):

Copy to clipboard

cloudinary.Api.UrlImgUp.Transform(new                  Transformation()   .AspectRatio(                    "                    ane.0                    "                  ).Gravity(                    "                    confront                    "                  ).Width(0.six).Zoom(0.7).Crop(                    "                    thumb                    "                  ).Chain()   .Radius(                    "                    max                    "                  ).Chain()   .Colour(                    "                    brown                    "                  ).Effect(                    "                    outline                    "                  )).Suffix(                    "                    baloncesto-juego                    "                  ).BuildImageTag(                    "                    t8sn7wg4jd74j.jpg                    "                  )

iOS (cloudinary 3.10):

Copy to clipboard

imageView.cldSetImage(cloudinary.createUrl().setSuffix(                                      "                    baloncesto-juego                    "                  ).setTransformation(CLDTransformation()   .setAspectRatio(                    "                    i.0                    "                  ).setGravity(                    "                    face                    "                  ).setWidth(0.half-dozen).setZoom(0.7).setCrop(                    "                    thumb                    "                  ).chain()   .setRadius(                    "                    max                    "                  ).chain()   .setColor(                    "                    dark-brown                    "                  ).setEffect(                    "                    outline                    "                  )).generate(                    "                    t8sn7wg4jd74j.jpg                    "                  )!, cloudinary: cloudinary)

Android (cloudinary-android 1.x):

Copy to clipboard

MediaManager.get().url().transformation(new                  Transformation()   .aspectRatio(                    "                    i.0                    "                  ).gravity(                    "                    face                    "                  ).width(0.six).zoom(0.7).crop(                    "                    thumb                    "                  ).chain()   .radius(                    "                    max                    "                  ).chain()   .color(                    "                    brown                    "                  ).consequence(                    "                    outline                    "                  )).suffix(                    "                    baloncesto-juego                    "                  ).generate(                    "                    t8sn7wg4jd74j.jpg                    "                  );

Kotlin (kotlin-url-gen 1.x):

Spanish SEO suffix

CNAMEs

You can also brand your URLs more SEO friendly by using a custom domain (CNAME) for your URLs instead of the shared res.cloudinary.com. The dynamic SEO suffix and CNAME features can also be used together, for example:

https://<mydomain.com>/images/t8sn7wg4jd74j/basktetball-game.jpg

CNAMEs are bachelor for Cloudinary'south Advanced programme and higher, and requires a small setup on Cloudinary'south side. For more data, see Private CDNs and CNAMEs.

Using a default image placeholder

Default images can be used in the case that a requested epitome does non exist. For example, a site that automatically stores user profile pictures with the same name equally the user themselves, assuasive you to reference the pictures by user name (unless the user has not uploaded a profile picture yet). Specify a default paradigm to use with the default_image parameter (d in URLs) and the public ID + format of a previously uploaded image, for instance, d_placeholder.png to use the image with the public ID of placeholder as the default image. Any requested transformations are also practical on the default image as well.

For instance, to utilize the PNG paradigm called avatar as a default image in the example that the epitome called non_existing_id does not exist:

Blood-red (cloudinary 1.x):

Copy to clipboard

cl_image_tag(                    "                    non_existing_id.png                    "                  ,                  :default_image=>                    "                    avatar.png                    "                  )

PHP (cloudinary_php 2.ten):

Copy to clipboard

(new                  ImageTag(                    '                    non_existing_id.png                    '                  ))   ->delivery(Delivery::defaultImage(                    "                    avatar.png                    "                  ));

PHP (cloudinary_php ane.x (legacy)):

Re-create to clipboard

cl_image_tag(                    "                    non_existing_id.png                    "                  ,                  assortment(                    "                    default_image                    "                  =>                    "                    avatar.png                    "                  ))

Python (cloudinary 1.x):

Copy to clipboard

CloudinaryImage(                    "                    non_existing_id.png                    "                  ).epitome(default_image=                    "                    avatar.png                    "                  )

Node.js (cloudinary 1.x):

Copy to clipboard

cloudinary.prototype(                    "                    non_existing_id.png                    "                  , {default_image:                                      "                    avatar.png                    "                  })

Coffee (cloudinary 1.x):

Copy to clipboard

cloudinary.url().transformation(new                  Transformation().defaultImage(                    "                    avatar.png                    "                  )).imageTag(                    "                    non_existing_id.png                    "                  );

JS (@cloudinary/url-gen 1.ten):

Re-create to clipboard

                  new                  CloudinaryImage(                    "                    non_existing_id.png                    "                  ).commitment(defaultImage(                    "                    avatar.png                    "                  ));

JS (cloudinary-cadre 2.x (legacy)):

Copy to clipboard

cloudinary.imageTag(                    '                    non_existing_id.png                    '                  , {defaultImage:                                      "                    avatar.png                    "                  }).toHtml();

jQuery (cloudinary-jquery ii.x):

Copy to clipboard

                  $.cloudinary.image(                    "                    non_existing_id.png                    "                  , {default_image:                                      "                    avatar.png                    "                  })

React (@cloudinary/react one.10):

Re-create to clipboard

                    new                  CloudinaryImage(                    "                    non_existing_id.png                    "                  ).delivery(defaultImage(                    "                    avatar.png                    "                  ));

React (cloudinary-react 1.x):

Copy to clipboard

                  <Image                  publicId=                    "                    non_existing_id.png                    "                                    >                  <Transformation                  defaultImage=                    "                    avatar.png                    "                                    />                  </Image>                

Vue.js (cloudinary-vue 1.x):

Copy to clipboard

<cld-paradigm                  public-id=                    "                    non_existing_id.png                    "                                    >                  <cld-transformation                  default-image=                    "                    avatar.png                    "                                    />                  <                    /                    cld-paradigm>                                  

Angular (@cloudinary/ng ane.x):

Copy to clipboard

                    new                  CloudinaryImage(                    "                    non_existing_id.png                    "                  ).delivery(defaultImage(                    "                    avatar.png                    "                  ));

Angular (@cloudinary/angular-5.ten ane.ten (legacy)):

Copy to clipboard

<cl-image                  public-id=                    "                    non_existing_id.png                    "                                    >   <cl-transformation                  default-image=                    "                    avatar.png                    "                  >   <                    /                    cl-transformation>                                                        <                    /                  cl-image>

.NET (CloudinaryDotNet 1.x):

Copy to clipboard

cloudinary.Api.UrlImgUp.Transform(new                  Transformation().DefaultImage(                    "                    avatar.png                    "                  )).BuildImageTag(                    "                    non_existing_id.png                    "                  )

iOS (cloudinary 3.ten):

Copy to clipboard

imageView.cldSetImage(cloudinary.createUrl().setTransformation(CLDTransformation().setDefaultImage(                    "                    avatar.png                    "                  )).generate(                    "                    non_existing_id.png                    "                  )!, cloudinary: cloudinary)

Android (cloudinary-android i.x):

Copy to clipboard

MediaManager.become().url().transformation(new                  Transformation().defaultImage(                    "                    avatar.png                    "                  )).generate(                    "                    non_existing_id.png                    "                  );

Kotlin (kotlin-url-gen 1.ten):

Copy to clipboard

cloudinary.image {   publicId(                    "                    non_existing_id.png                    "                  )    delivery(Commitment.defaultImage(                    "                    avatar.png                    "                  ))  }.generate()

avatar used as default image when requested image does not exist

The same instance every bit above, just with transformation parameters applied to scale downwards to 200 pixels wide and rotate by 45 degrees:

Ruby (cloudinary 1.10):

Re-create to clipboard

cl_image_tag(                    "                    non_existing_id.png                    "                  ,                  :transformation=>[   {:angle=>45},   {:width=>200,                  :crop=>                    "                    scale                    "                  },   {:default_image=>                    "                    avatar.png                    "                  }   ])

PHP (cloudinary_php 2.x):

Re-create to clipboard

(new                  ImageTag(                    '                    non_existing_id.png                    '                  ))   ->rotate(Rotate::byAngle(45))   ->resize(Resize::scale()->width(200))   ->commitment(Delivery::defaultImage(                    "                    avatar.png                    "                  ));

PHP (cloudinary_php i.ten (legacy)):

Copy to clipboard

cl_image_tag(                    "                    non_existing_id.png                    "                  ,                  assortment(                    "                    transformation                    "                  =>array(                  array(                    "                    angle                    "                  =>45),                  array(                    "                    width                    "                  =>200,                                      "                    crop                    "                  =>                    "                    scale                    "                  ),                  array(                    "                    default_image                    "                  =>                    "                    avatar.png                    "                  )   )))

Python (cloudinary ane.x):

Copy to clipboard

CloudinaryImage(                    "                    non_existing_id.png                    "                  ).prototype(transformation=[   {                    '                    angle                    '                  :                  45},   {                    '                    width                    '                  :                  200,                                      '                    ingather                    '                  :                                      "                    scale                    "                  },   {                    '                    default_image                    '                  :                                      "                    avatar.png                    "                  }   ])

Node.js (cloudinary one.10):

Copy to clipboard

cloudinary.image(                    "                    non_existing_id.png                    "                  , {transformation: [   {bending:                  45},   {width:                  200,                  crop:                                      "                    calibration                    "                  },   {default_image:                                      "                    avatar.png                    "                  }   ]})

Java (cloudinary ane.10):

Re-create to clipboard

cloudinary.url().transformation(new                  Transformation()   .bending(45).chain()   .width(200).crop(                    "                    scale                    "                  ).concatenation()   .defaultImage(                    "                    avatar.png                    "                  )).imageTag(                    "                    non_existing_id.png                    "                  );

JS (@cloudinary/url-gen ane.10):

Copy to clipboard

                  new                  CloudinaryImage(                    "                    non_existing_id.png                    "                  )   .rotate(byAngle(45))   .resize(scale().width(200))   .delivery(defaultImage(                    "                    avatar.png                    "                  ));

JS (cloudinary-cadre 2.x (legacy)):

Re-create to clipboard

cloudinary.imageTag(                    '                    non_existing_id.png                    '                  , {transformation: [   {angle:                  45},   {width:                  200,                  ingather:                                      "                    calibration                    "                  },   {defaultImage:                                      "                    avatar.png                    "                  }   ]}).toHtml();

jQuery (cloudinary-jquery 2.x):

Copy to clipboard

                  $.cloudinary.image(                    "                    non_existing_id.png                    "                  , {transformation: [   {angle:                  45},   {width:                  200,                  ingather:                                      "                    scale                    "                  },   {default_image:                                      "                    avatar.png                    "                  }   ]})

React (@cloudinary/react i.x):

Copy to clipboard

                    new                  CloudinaryImage(                    "                    non_existing_id.png                    "                  )   .rotate(byAngle(45))   .resize(scale().width(200))   .delivery(defaultImage(                    "                    avatar.png                    "                  ));

React (cloudinary-react ane.10):

Re-create to clipboard

                  <Image                  publicId=                    "                    non_existing_id.png                    "                                    >                  <Transformation                  angle=                    "                    45                    "                                    />                  <Transformation                  width=                    "                    200                    "                                    crop=                    "                    calibration                    "                                    />                  <Transformation                  defaultImage=                    "                    avatar.png                    "                                    />                  </Image>                

Vue.js (cloudinary-vue i.x):

Copy to clipboard

<cld-epitome                  public-id=                    "                    non_existing_id.png                    "                                    >                  <cld-transformation                  angle=                    "                    45                    "                                    />                  <cld-transformation                  width=                    "                    200                    "                                    crop=                    "                    scale                    "                                    />                  <cld-transformation                  default-image=                    "                    avatar.png                    "                                    />                  <                    /                    cld-image>                                  

Angular (@cloudinary/ng 1.x):

Copy to clipboard

                    new                  CloudinaryImage(                    "                    non_existing_id.png                    "                  )   .rotate(byAngle(45))   .resize(scale().width(200))   .commitment(defaultImage(                    "                    avatar.png                    "                  ));

Angular (@cloudinary/angular-five.10 1.10 (legacy)):

Copy to clipboard

<cl-prototype                  public-id=                    "                    non_existing_id.png                    "                                    >   <cl-transformation angle=                    "                    45                    "                  >   <                    /                    cl-transformation>                                                                              <cl-transformation width="200" crop="calibration">                                                                              <                    /                  cl-transformation>   <cl-transformation                  default-paradigm=                    "                    avatar.png                    "                  >   <                    /                    cl-transformation>                                                        <                    /                  cl-image>

.NET (CloudinaryDotNet 1.10):

Copy to clipboard

cloudinary.Api.UrlImgUp.Transform(new                  Transformation()   .Angle(45).Chain()   .Width(200).Ingather(                    "                    scale                    "                  ).Chain()   .DefaultImage(                    "                    avatar.png                    "                  )).BuildImageTag(                    "                    non_existing_id.png                    "                  )

iOS (cloudinary 3.ten):

Copy to clipboard

imageView.cldSetImage(cloudinary.createUrl().setTransformation(CLDTransformation()   .setAngle(45).chain()   .setWidth(200).setCrop(                    "                    scale                    "                  ).concatenation()   .setDefaultImage(                    "                    avatar.png                    "                  )).generate(                    "                    non_existing_id.png                    "                  )!, cloudinary: cloudinary)

Android (cloudinary-android 1.x):

Copy to clipboard

MediaManager.get().url().transformation(new                  Transformation()   .angle(45).concatenation()   .width(200).ingather(                    "                    calibration                    "                  ).chain()   .defaultImage(                    "                    avatar.png                    "                  )).generate(                    "                    non_existing_id.png                    "                  );

Kotlin (kotlin-url-gen 1.10):

Re-create to clipboard

cloudinary.epitome {   publicId(                    "                    non_existing_id.png                    "                  )    rotate(Rotate.byAngle(45))    resize(Resize.scale() { width(200) })    delivery(Delivery.defaultImage(                    "                    avatar.png                    "                  ))  }.generate()

avatar used as default image when requested image does not exist

If the default epitome is in a folder, specify its public ID replacing slashes with colons (eastward.g., an image with public ID docs/placeholders/samples/avatar.png should exist referenced as d_docs:placeholders:samples:avatar.png). The intended image should be specified with slashes as normal. For case:

Ruby (cloudinary i.10):

Copy to clipboard

cl_image_tag(                    "                    folder1/folder2/non_existing_id.png                    "                  ,                  :transformation=>[   {:width=>100,                  :crop=>                    "                    scale                    "                  },   {:default_image=>                    "                    docs:placeholders:samples:avatar.png                    "                  }   ])

PHP (cloudinary_php 2.10):

Copy to clipboard

(new                  ImageTag(                    '                    folder1/folder2/non_existing_id.png                    '                  ))   ->resize(Resize::scale()->width(100))   ->delivery(Delivery::defaultImage(                    "                    docs:placeholders:samples:avatar.png                    "                  ));

PHP (cloudinary_php ane.10 (legacy)):

Copy to clipboard

cl_image_tag(                    "                    folder1/folder2/non_existing_id.png                    "                  ,                  array(                    "                    transformation                    "                  =>array(                  array(                    "                    width                    "                  =>100,                                      "                    crop                    "                  =>                    "                    scale                    "                  ),                  array(                    "                    default_image                    "                  =>                    "                    docs:placeholders:samples:avatar.png                    "                  )   )))

Python (cloudinary ane.ten):

Copy to clipboard

CloudinaryImage(                    "                    folder1/folder2/non_existing_id.png                    "                  ).prototype(transformation=[   {                    '                    width                    '                  :                  100,                                      '                    crop                    '                  :                                      "                    scale                    "                  },   {                    '                    default_image                    '                  :                                      "                    docs:placeholders:samples:avatar.png                    "                  }   ])

Node.js (cloudinary i.10):

Re-create to clipboard

cloudinary.image(                    "                    folder1/folder2/non_existing_id.png                    "                  , {transformation: [   {width:                  100,                  crop:                                      "                    scale                    "                  },   {default_image:                                      "                    docs:placeholders:samples:avatar.png                    "                  }   ]})

Java (cloudinary 1.x):

Copy to clipboard

cloudinary.url().transformation(new                  Transformation()   .width(100).crop(                    "                    calibration                    "                  ).chain()   .defaultImage(                    "                    docs:placeholders:samples:avatar.png                    "                  )).imageTag(                    "                    folder1/folder2/non_existing_id.png                    "                  );

JS (@cloudinary/url-gen 1.x):

Copy to clipboard

                  new                  CloudinaryImage(                    "                    folder1/folder2/non_existing_id.png                    "                  )   .resize(scale().width(100))   .commitment(defaultImage(                    "                    docs:placeholders:samples:avatar.png                    "                  ));

JS (cloudinary-cadre 2.x (legacy)):

Copy to clipboard

cloudinary.imageTag(                    '                    folder1/folder2/non_existing_id.png                    '                  , {transformation: [   {width:                  100,                  crop:                                      "                    scale                    "                  },   {defaultImage:                                      "                    docs:placeholders:samples:avatar.png                    "                  }   ]}).toHtml();

jQuery (cloudinary-jquery 2.x):

Copy to clipboard

                  $.cloudinary.paradigm(                    "                    folder1/folder2/non_existing_id.png                    "                  , {transformation: [   {width:                  100,                  ingather:                                      "                    scale                    "                  },   {default_image:                                      "                    docs:placeholders:samples:avatar.png                    "                  }   ]})

React (@cloudinary/react i.x):

Copy to clipboard

                    new                  CloudinaryImage(                    "                    folder1/folder2/non_existing_id.png                    "                  )   .resize(scale().width(100))   .delivery(defaultImage(                    "                    docs:placeholders:samples:avatar.png                    "                  ));

React (cloudinary-react 1.10):

Re-create to clipboard

                  <Epitome                  publicId=                    "                    folder1/folder2/non_existing_id.png                    "                                    >                  <Transformation                  width=                    "                    100                    "                                    crop=                    "                    scale                    "                                    />                  <Transformation                  defaultImage=                    "                    docs:placeholders:samples:avatar.png                    "                                    />                  </Image>                

Vue.js (cloudinary-vue one.10):

Re-create to clipboard

<cld-image                  public-id=                    "                    folder1/folder2/non_existing_id.png                    "                                    >                  <cld-transformation                  width=                    "                    100                    "                                    crop=                    "                    scale                    "                                    />                  <cld-transformation                  default-image=                    "                    docs:placeholders:samples:avatar.png                    "                                    />                  <                    /                    cld-image>                                  

Angular (@cloudinary/ng 1.x):

Copy to clipboard

                    new                  CloudinaryImage(                    "                    folder1/folder2/non_existing_id.png                    "                  )   .resize(calibration().width(100))   .delivery(defaultImage(                    "                    docs:placeholders:samples:avatar.png                    "                  ));

Angular (@cloudinary/angular-5.x 1.10 (legacy)):

Copy to clipboard

<cl-image                  public-id=                    "                    folder1/folder2/non_existing_id.png                    "                                    >   <cl-transformation width=                    "                    100                    "                                    crop=                    "                    scale                    "                  >   <                    /                    cl-transformation>                                                                              <cl-transformation default-paradigm="docs:placeholders:samples:avatar.png">                                                                              <                    /                  cl-transformation> <                    /                    cl-paradigm>                                  

.Net (CloudinaryDotNet 1.x):

Re-create to clipboard

cloudinary.Api.UrlImgUp.Transform(new                  Transformation()   .Width(100).Ingather(                    "                    scale                    "                  ).Chain()   .DefaultImage(                    "                    docs:placeholders:samples:avatar.png                    "                  )).BuildImageTag(                    "                    folder1/folder2/non_existing_id.png                    "                  )

iOS (cloudinary 3.x):

Re-create to clipboard

imageView.cldSetImage(cloudinary.createUrl().setTransformation(CLDTransformation()   .setWidth(100).setCrop(                    "                    calibration                    "                  ).chain()   .setDefaultImage(                    "                    docs:placeholders:samples:avatar.png                    "                  )).generate(                    "                    folder1/folder2/non_existing_id.png                    "                  )!, cloudinary: cloudinary)

Android (cloudinary-android ane.x):

Copy to clipboard

MediaManager.get().url().transformation(new                  Transformation()   .width(100).ingather(                    "                    scale                    "                  ).chain()   .defaultImage(                    "                    docs:placeholders:samples:avatar.png                    "                  )).generate(                    "                    folder1/folder2/non_existing_id.png                    "                  );

Kotlin (kotlin-url-gen 1.x):

Re-create to clipboard

cloudinary.image {   publicId(                    "                    folder1/folder2/non_existing_id.png                    "                  )    resize(Resize.scale() { width(100) })    delivery(Commitment.defaultImage(                    "                    docs:placeholders:samples:avatar.png                    "                  ))  }.generate()

avatar used as default image when requested image does not exist

If the requested image does not exist and the default placeholder image is delivered instead, the x_cld_error header will also be included in the response.

Generating delivery URL signatures

Cloudinary delivery URLs require a signature component under the following circumstances:

  • Authenticated media assets - all assets uploaded with their resource_type ready to authenticated
  • Dynamic transformations with strict transformations enabled - this only applies to generating and and then delivering new derived assets dynamically (on the fly).
  • Dynamic transformations with sure add-ons - this only applies if the add-on has never been used with the asset earlier. If you use a Cloudinary addition that supports on-the-wing activation of the improver adequacy in a transformation URL, check the relevant addition documentation for the signature requirements.
  • The signature component is automatically generated and added to the URL when y'all use 1 of Cloudinary'due south SDK helper methods you include the sign_url boolean parameter set to true.
  • api_secret, which is a required chemical element of in signature generation, should never be revealed to anyone who is non authorized, and therefore your signature should never be generated on the client side or inside your native application.

To manually create a signed delivery URL, you also demand to create a signature component of the format /southward--SIGNATURE--/ that is based on the Public ID and whatsoever transformations or version number you lot use in the remainder of the delivery URL. The SIGNATURE is the commencement 8 characters of a URL-safe base64 message digest (hash value) created with an SHA (Secure Hash Algorithm) cryptographic function.

By default, Cloudinary supports both SHA-ane and SHA-256 digests for validation, and you lot can use either. The SDK methods use the SHA-1 algorithm by default, but you can apply the SHA-256 algorithm instead by setting the signature_algorithm SDK configuration parameter to sha256. If you desire to limit your account to allow only the SHA-256 digest for all your validations, submit a asking.

To generate the URL signature:

  1. Create a unmarried string including all of the directives for the asset to deliver: whatsoever transformation parameters, the version number, the public_id, and file extension that will be used in the delivery URL, separating each component with slashes (/) (this string is exactly equivalent to the components of the delivery URL that will come after the signature).
  2. Append your API hugger-mugger to the end of the string.
  3. Create a URL-safe base64 message digest (hash value) of the string using an SHA cryptographic role.

For example, if your API secret is abcd, and you need to generate a signature for the sample image scaled to 300x250, with a grayscale effect (w_300,h_250,e_grayscale), and delivered as a PNG:

  • Parameters to sign:
    • w_300,h_250,e_grayscale
    • sample.png
  • Parameters in a single string joined with a slash:
    • w_300,h_250,e_grayscale/sample.png
  • String including the API secret that is used to create the signature:
    • w_300,h_250,e_grayscale/sample.pngabcd
  • SHA-1 base64 result:
    • INQUGuluWsGzxkcBaITPo7KMKic
  • Offset 8 characters to employ every bit URL signature:
    • INQUGulu
  • Full signature component including prefix and suffix:
    • south--INQUGulu--

The last delivery URL including the signature:

https://res.cloudinary.com/demo/image/upload/southward--INQUGulu--/w_300,h_250,e_grayscale/sample.png

An case of the above in Ruby on Rails:

Copy to clipboard

transformation =                              "                w_300,h_250,e_grayscale                "                            public_id =                              "                sample.png                "                            clandestine =                              "                abcd                "                            to_sign = ([transformation, public_id]).join(                "                /                "              ) signature =                              '                southward--                '                            +              Base64.urlsafe_encode64(Digest::SHA1.assimilate(to_sign + secret))[0,8] +                              '                --                '                            url =                              '                https://res.cloudinary.com/demo/image/upload/                '                            + ([signature, to_sign]).join(                "                /                "              )

Encounter also: Have a look at the Cloudinary Signatures quick reference for a summary of the payload string to sign for commitment URL signatures besides as information on other use cases that may crave signature generation.

wilsonfrouleem.blogspot.com

Source: https://cloudinary.com/documentation/advanced_url_delivery_options

0 Response to "Cloudinary Different Public Id When Uploading Multiple Images"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel