@cloudinary/url-gen generates wrong url while trying to retrieve images in a folder
This is the code that i use
const cld = new Cloudinary({
cloud: {
cloudName: process.env.REACT_APP_CLOUD_NAME,
},
});
const newImage = cld.image(image);
And the result is
correct URL = https://res.cloudinary.com/dmu2k144t/image/upload/v1650962083/twittclone/2022-04-26T08-34-42.296Z-staff picks.jpg
I also tried specifying the version with .version but the URL was still different and resulted in a 404 error.
0
-
Hi Kristiyan,
Thanks for reaching out.
The first image is not found because it seems you saved the image with its extension, so the public id for it is actually "2022-04-26T08-43-44.294Z-watch.webp". If you include a
.
character in a public ID, that simply becomes part of the ID itself.If you were to pass "2022-04-26T08-43-44.294Z-watch.webp" to the URL generator then you'd get:
which works but we recommend not to include the extension in the public id for media-related sources so you can just update the asset to not have ".webp" in its public id and your code should work.
I recommend reading the note in this link, please let me know if you have any questions.
Kind Regards,
Thomas0
Post is closed for comments.
Comments
1 comment