Get Public Id from URL
Closed this issue · 2 comments
Hi, I want a function that get an image public id of url image that I has uploaded to cloudinary.
I uploaded many image manually, not from laravel. There are many of image that I uploaded, cause I don't know how to store it to database, so I just store the url of the image uploaded in a column, but now I want to make function that can delete the image from application I make.
I read the function of image is must know the public id of that image right?, but column that I just store is just the url, so how can I make function that can delete from url or function that I can get the public id from url
Any help is appreciated, many thanks
If your url is of the form https://res.cloudinary.com/jdcloudder/image/upload/v1558314941/smokach3k4nlq16njthl.jpg the public id will be smokach3k4nlq16njthl
in that case.
So a simple regex or multiple explode
calls should be enough to give you the public ids of your uploaded pictures.
Thank you very much