Dynamically transform and deliver a custom image conversion
Static Image Conversions are generated automatically on image uploads based on User Accounts Image Settings. They can also be done via /process
API call. See Asset Processing API
section on how to use the /process
API.
Using a Custom Image Conversion
To request transformation using a Custom Image Conversion, use the same URL as the Standard Image Conversion with the static image conversion name appended, like
<<CDN_HOST>>/api/v1/assets/{ASSET_ID}/conversions/{conversion_name}?resize=300,300
where, conversion_name
is the custom name specified for the static conversion in your Image Settings.
For example, if the account has a static image conversion called black_and_white
, this can be requested via:
<<CDN_HOST>>/api/v1/assets/0c3c6d026858460abc4de1dcb4de15ac/conversions/black_and_white
A 300x300 resized static conversion can be requested via:
<<CDN_HOST>>/api/v1/assets/0c3c6d026858460abc4de1dcb4de15ac/conversions/black_and_white?resize=300,300
As shown above, all the on-demand URL options such as resize, crop, etc. can be used for a static image conversion.
Using non-public Custom Image Conversion
If a static image conversion is not public, the request must be authenticated. This can be done in two ways:-
- by passing
X-FileSpin-Api-Key:{API_KEY}
if the request is made from a server-side application (see Authentication) - by passing
Authorization: Bearer {JWT}
header in the request if the request is made from a client-side application (see JWT Authentication) - by signing the request URL. A signed URL can be generated using the same method detailed for On-demand Image Conversion. Please see Signed URL for image transformations