C
C#9mo ago
ItaM

❔ Cloduinary API in .NET, something similar to .UploadRange?

No description
13 Replies
ItaM
ItaM9mo ago
I am currently implementing the Cloduinary API to upload images (thats the only purpose), to add multiple images, i am simply iterating over all the images, and adding them one by one, then returning the url and finally adding it to a database So i was wondering if a method similar to .AddRange exists for this API How would you handle multiple image uploads with the cloduinary API?
No description
softmek
softmek9mo ago
Cloudinary primarily provides methods to upload images one by one, and there isn't a built-in .AddRange-like method to upload multiple images in a single request using the Cloudinary API. To handle multiple image uploads efficiently, you would typically iterate through your list of images and upload them individually. However, you can optimize the process to make it more efficient and convenient.
ItaM
ItaM9mo ago
Thank you so much for the response. Will be looking for ways to make it more optimal, because sometimes it feels kinda slow, however that will always be tied to upload speed.
softmek
softmek9mo ago
No prob, You can drop the code and we I can help optimize it as well
ItaM
ItaM9mo ago
This is what I currently have, this is in charge of uploading an image only. One by one
No description
ItaM
ItaM9mo ago
To add images, I do a foreach and add them one by one. The new images are saved in the image table, with a foreign key reference to the items table, for easy retrieval with nav properties
ItaM
ItaM9mo ago
No description
ItaM
ItaM9mo ago
When we add the post, we first save the post into the db, save the changes and send the image collection to the AddImages method The dto its necessary to avoid a json serialization error I got
No description
ItaM
ItaM9mo ago
So there are a total of three o(n) complexity operations there. * the foreach for every image upload * the .Select for mapping the image to an imageDto * and the .AddRange of the imageDto collection that I return
ItaM
ItaM9mo ago
And this is the controller btw, no iterations done here since its just one entity
No description
ItaM
ItaM9mo ago
Well with this I removed one iteration @softmek
No description
ItaM
ItaM9mo ago
Or, maybe no, there is still and AddRange and a Select
Accord
Accord9mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.