@hotfuzz123 I think the only way you can do this right now is if you are storing the public_id(which could be the filename) of the uploaded file in your database. Then you can use that to delete the resource from Cloudinary by supplying the `public_id` to the ```destroy()``` method of the Cloudinary API. #41
@hotfuzz123 I think the only way you can do this right now is if you are storing the public_id(which could be the filename) of the uploaded file in your database. Then you can use that to delete the resource from Cloudinary by supplying the public_id to the destroy() method of the Cloudinary API.
So the flow could be something like this (using the example of a user updating their profile picture):
User enters details in the profile picture form to be updated.
Before the actual update is done, you retrieve the public_id or file_name attached to the user in the users table or the media table which comes with the Cloudinary package.
Use the public_id to make a destroy call to delete the previous image.
upload the new image to Cloudinary and update the respective tables with the new values.
@hotfuzz123 I think the only way you can do this right now is if you are storing the public_id(which could be the filename) of the uploaded file in your database. Then you can use that to delete the resource from Cloudinary by supplying the
public_id
to thedestroy()
method of the Cloudinary API.So the flow could be something like this (using the example of a user updating their profile picture):
public_id
orfile_name
attached to the user in theusers
table or themedia
table which comes with the Cloudinary package.public_id
to make adestroy
call to delete the previous image.Something along these lines should probably work.
Originally posted by @dela-dels in https://github.com/cloudinary-labs/cloudinary-laravel/issues/40#issuecomment-863337811