Loose publicId value
Hi,
I want to make using Cloudinary as easy as possible for my client. The scope of the project does not allow for me to set up a full-blown media library widget in the CMS, so I would just have them insert the image link to a standard input field. This way - all they need to do is click the handy link button in the library.
However - isolating the filename with any associated folders for the publicId has been tricky especially with the version ID included in the link (which I'd rather not disable).
I've experimented with inserting the ID, filename and extension as the publicId (React <Image cloudName="xxxxxx" publicId="v1579560178/sample.jpg" />) and it worked, even when including transformations.
Is this hack prone to errors or is it viable for production?
Thanks!
-
Hi Avi,
The folder is part of the publicId of the image and therefore you need to add it to the file name (and not isolate it). For example, if your file: "casual" is in the "docs" folder, the publicId would be: "docs/casual".
In addition, the version should be added to the version attribute. Like in this example:
<Image publicId="docs/casual" version="1573726751" cloud_name="demo" width="300" />
0
Post is closed for comments.
Comments
1 comment