cloudinary / cloudinary_ios

Cloudinary iOS SDK
MIT License
165 stars 106 forks source link

Cannot replace an image #87

Closed joaoricardoduarte closed 7 years ago

joaoricardoduarte commented 7 years ago

I am trying to replace an existing image using the same publicId but it is not replacing. I keep getting the original image. The upload is successful, so no errors.

I have read in the docs that we should be using version number but it makes no difference.

shirlymanor commented 7 years ago

In order to provide a better feedback, can you please share the URL? In case you have any privacy issue, you're more than welcomed to open a ticket and we'll be happy to suggest specific tips for you:

joaoricardoduarte commented 7 years ago

this is now sorted. Basically to override an image the upload needs to be signed.

shirlymanor commented 7 years ago

Thanks for the update, glad to hear it's working :) Feel free to contact our support team or here if you need anything else.

erperejildo commented 4 years ago

this is now sorted. Basically to override an image the upload needs to be signed.

how do you sign it. (I use Flutter)

shirlymanor commented 4 years ago

Our best practice will be to use some kind of server. The reason behind it is that signed upload required sensitive data such as API Secret that we do not recommend sharing on the client-side. If you are using nodeJS as a server. you can use something like:

cloudinary.v2.uploader.upload("sample.jpg", 
  { resource_type: "image", 
    public_id: "new_image_name"},
  function(error, result) {console.log(result, error)});
erperejildo commented 4 years ago

Our best practice will be to use some kind of server. The reason behind it is that signed upload required sensitive data such as API Secret that we do not recommend sharing on the client-side. If you are using nodeJS as a server. you can use something like:

cloudinary.v2.uploader.upload("sample.jpg", 
  { resource_type: "image", 
    public_id: "new_image_name"},
  function(error, result) {console.log(result, error)});

I user Firebase for my app, not a dedicate server

yakirp commented 4 years ago

Hey @erperejildo , You can use Firebase Functions as your singing function endpoint. But in order to provide you a full solution, I would like to ask if you can elaborate more on your use-case? Generally speaking, if you don't use our SDKs, you need to send the upload parameters to your backend (Firebase Functions) to sign them with your secret API key, and use the signature in your cline side.

I'm looking forward to your response.

Best, --Yakir

erperejildo commented 4 years ago

Hey @erperejildo , You can use Firebase Functions as your singing function endpoint. But in order to provide you a full solution, I would like to ask if you can elaborate more on your use-case? Generally speaking, if you don't use our SDKs, you need to send the upload parameters to your backend (Firebase Functions) to sign them with your secret API key, and use the signature in your cline side.

I'm looking forward to your response.

Best, --Yakir

I never tried those kind of functions but if you mention that it's possible I'll have a look.

My app creates different properties and on each of them you can upload a background picture. It's built using Flutter and my backend as commented is 100% Firebase using Firestore database.

If the user uploads another picture it'd be nice replace the old one with new uploaded picture to save me space.

shirlymanor commented 4 years ago

When using signed upload with incoming transformation, you can specify the public_id (name of the asset) and it will replace it with the new one. Please note that you will need to add the invalidate parameter to true at uploading time, in order to invalidate the image CDN cache.

erperejildo commented 4 years ago

ok, I'll have a look to see how can I archive this using Firebase functions.

Thanks.

iamevansobeng commented 1 year ago

Our best practice will be to use some kind of server. The reason behind it is that signed upload required sensitive data such as API Secret that we do not recommend sharing on the client-side. If you are using nodeJS as a server. you can use something like:

cloudinary.v2.uploader.upload("sample.jpg", 
  { resource_type: "image", 
    public_id: "new_image_name"},
  function(error, result) {console.log(result, error)});

I user Firebase for my app, not a dedicate server

What package are you using here?