Upload and destroy images dynamically doesn't work properly
Hey,
First of all thank you very much for this gorgeous API : it's really usefull. Also, I'm french so sorry for my bad English.
Now, I'm making a discord bot that uses this API to modify an image on the fly in order to display the user's profile picture and the server's profile picture. (Just a basic Welcome Image). So, I retrieve the user's profile picture and server's profile picture, I upload them on my Cloudinary account with a public id ("pp1" for the user's one and "pp2" for the server's one). And I finally use pp1 and pp2 as overlays and send the welcome Image. When it is sended, i just erase them from my account. The thing is, everything seems working but my images aren't updating (even if the user 's or server's profile picture is different than the one before, it will keep showing me the same one.)
I hope you understood why I wrote and by the way here's my code : https://hastebin.com/patililelo.js
Thank you in advance :)
-
Hi @Zankro,
Thank you, we are glad you enjoy using our product :)
I believe I know what may be happening. When the images are being overwritten with the same `public_id`, the original images are not invalidated on the CDN. To invalidate the images on the CDN, please include the `invalidate` parameter set to `true`, however, I would advise using the destroy API call instead of `delete_resources_by_prefix`. The destroy API call is not rate limited, and can include the `invalidate` parameter set to `true`. More info can be found here: https://cloudinary.com/documentation/image_upload_api_reference#destroy
But before you do that, we need to make sure that the correct URLs are invalidated. From the following options outlined here, https://support.cloudinary.com/hc/en-us/articles/360001208732-What-URL-conventions-are-invalidated, which one is used throughout your site? Currently, your account is set to invalidate option 1, but we can change it if needed.
If you wish to discuss this in private, please feel free to open a support ticket and refer to me. https://support.cloudinary.com/hc/en-us/requests/new
I am looking forward to your update.
0 -
Hi @Daniel
I am very grateful that you answered, otherwise I wouldn't figure it out by myself ! It worked perfectly by using invalidate and by set it to `true`. Thank you so much !
Btw, is there anything I can do to manipulate images faster on-the-fly with node and cloudinary obviously cause my bot need to be very fast but at the same time I don't want to reduce the image quality :3
Thanks again ;)
0 -
Hi @Zankro
I'm glad it worked out :)
There are two options here:
1. Add `quality` parameter set to `auto` (`q_auto` in URLs) in the welcomeMessageURL, this will reduce the size of the image, but it may not change the amount of time to process. The reason is that there is quite a complex transformation with several overlays going on there.
2. The second approach would be to reduce the size of the image before upload. The size can be reduced by changing the width and height and you can try to add the parameter `quality` set to `auto` (`q_auto` in URLs) during the upload. This should reduce the size of the file down with minimal effects to the quality. I would give that a go on some sample images and see how it works out.
Hope this helps!
0 -
Hello again @Daniel Mendoza,
I thought my code was working but I was wrong... I got a very VERY weird problem that I can't explain by text, i need to talk to you or one person from the cloudinary staff.. Seriously this is getting me mad aha.
Here is a picture so you can have a preview of my problem : https://imgur.com/a/EX5KjVw
Thank you very much again :)
0 -
Hi @Zankro
It looks like a caching issue, but we will need to do a deeper investigation. Please also share the Cloudinary image URLs of pp1 and pp2 and the Cloudinary URL that has both overlays included?
Please open a support ticket at https://support.cloudinary.com/hc/en-us/requests/new.
0
Post is closed for comments.
Comments
5 comments