Extract Public Id
Public Id of a Cloudinary asset is the path to that asset stored in Cloudinary, path-to-image as shown below:
Public Id doesn't include asset extension or format. For example: an image example.jpg will have public Id example.
You can easily extract the target public Id using the following method:
extractPublicId(link)
link:- Type:
String - Cloudinary asset URL.
- Type:
import { extractPublicId } from 'cloudinary-build-url'
const publicId = extractPublicId(
"http://res.cloudinary.com/demo/image/upload/v1312461204/sample.jpg"
) //sample