Lepozepo / cloudinary

MIT License
94 stars 42 forks source link

How to get URL from public_id on server? #37

Open rafaelcorreiapoli opened 9 years ago

rafaelcorreiapoli commented 9 years ago

I need the URL on server to use on third party services (face recognition API), how could I grab the url on server side?

sambegin commented 8 years ago

@rafaelcorreiapoli Had the same problem, You can use this on server side :

SERVER SIDE : Cloudinary.utils.url(filePublicId, {transformation: transformation,devicePixelRatio});

CLIENT SIDE : Cloudinary._helpers.url(filePublicId, {transformation: transformation, devicePixelRatio});

JulianKingman commented 7 years ago

Thanks @sambegin, that's super helpful. I wish it were isometric. This is what I did, to work with the server-side rendering:

let pictureOpts = {hash: {width: 55, height: 55, crop: 'fill'}};
let imageUrl = Meteor.isServer ? Cloudinary.utils.url(photoId, pictureOpts) : Cloudinary._helpers.url(photoId, pictureOpts);