Reverse of `url(publicId: string, options?: UrlOptions ): string;` function?
Inside cloudinary-core js lib, is there a function that takes a Cloudinary URL and parses/transforms it back to a chain of transformations, the reverse of `url(publicId: string, options?: UrlOptions ): string;` function?
-
Hi Ciprian,
Thank you for reaching out, we do not have such a function that reverses a URL but if you can tell me exactly what you are trying to achieve with an example then I can check if we have other solutions.
Please let me know if you have any other questions or queries.
Kind Regards,
Thomas -
Hello Thomas,
Thanks for your reply.
We need to store the complete Cloudinary URLs (https://cloudinary.com/documentation/image_transformations#transformation_url_structure), not just the public_id, and have the ability to parse the URL and get the transformations back, as JSON.
In the end, we need to get those transformations, feed them to an app and provide the ability to edit them.To add a bit more context, our end goal is to build an image editor based on Cloudinary transformations. The resulting image will have a Cloudinary URL with transformations that will be saved in our database. When we load the image in the editor at a later time, it would be very useful to be able to deconstruct the URL so that we are able to pick up each transformation and make it available for editing.
Regards,
Ciprian
-
Hi Ciprian,
Thank you for getting back.
You could use our Admin API which would return all the transformations used in a JSON format. More on this API here.
So for example, say you have this image: https://res.cloudinary.com/demo/image/upload/c_fit,w_200/g_north/sample.jpg
My-terminal$ cld transformation "c_fit,w_200/g_north"
"info": [
{
"width": 200,
"crop": "fit"
},
{
"gravity": "north"
}
],Please note Admin API is a rate-limited API so check your hour limit and craft your requests based on that.
Please let me know if you have any other questions or queries.
Kind Regards,
Thomas
Post is closed for comments.
Comments
5 comments