Eager transformations for existing image

caprica
caprica Member Posts: 11
edited November 2023 in Developer APIs

I have two related use-cases pertaining to image upload and transformations.

First: upload an image and include an eager transformation. I will end up with two images, the original image and the transformed image.

Some time later...

Second: generate a replacement for the eager transformation, without having to re-upload the original image, but keeping the same benefits of an eager transformation (async operation etc).

Is this possible? If so, can anyone provide some pointers?

I'm initially using cloudinary.uploader.updload_stream() in a Remix server-side action (NodeJS/Typescript) for the upload, and passing eager options for a single transformation.

And a follow-up question, is it the case that you can not get a new public id for the transformed image, you are supposed to use the full transformation options in the URL?

Best Answer

  • Cloudinary Team
    Cloudinary Team Administrator, Cloudinary Staff Posts: 160 admin
    Answer ✓

    Hi there,

    Thanks for reaching out.

    I'm not quite sure what you mean by 'generate a replacement for the eager transformation...'. You can not overwrite a derived the way that you can overwrite an original file. If you no longer need or want the derived, you can delete it. You can then use the explicit method of the Upload API to generate new eager transformations.
    You can reference that documentation here:
    https://cloudinary.com/documentation/image_upload_api_reference#explicit

    Please take a look at that documentation and let me know what you think. If I have misunderstood your question, definitely let me know.

    Kind regards,

    Tia

    Helpful Links For You
    💬 Share questions, connect with other users in our Cloudinary Community forums and Discord server!
    🧑‍🎓 Join our Cloudinary Academy for free courses, workshops and other educational resources.
    📄 Read our documentation for in-depth details on Cloudinary product features and capabilities
    📰 Check out the Cloudinary blog for the latest company news and insights

Answers

  • caprica
    caprica Member Posts: 11
    edited November 2023

    Thanks for your reply.

    From your link:

    "The explicit method is used to apply actions to already uploaded assets. The most common usage of this method is to eagerly generate transformations for assets that have already been uploaded, either so that they do not need to be generated on the fly when first accessed by users, or because Strict transformations are enabled for your product environment and you cannot create transformed assets on the fly"

    I think this should be perfect, thank you!