cloudinary / pkg-cloudinary-core

Distribution repository for the Cloudinary JavaScript library. Cloudinary is an end-to-end solution for all your image and video needs.
MIT License
54 stars 28 forks source link

Can't chain transformations on `imageTag` #13

Closed ewal closed 7 years ago

ewal commented 7 years ago

(Tried this with both imageTag and ImageTag). I'm trying to chain a transformation on an imageTag but get an error saying Uncaught Unknown cloud_name when using .chain() before calling .toHtml().

Example code:

const tag = cloudinaryInstance.imageTag(cloudinaryId);
tag.transformation().crop('crop').width(1000).height(1000).chain().crop('limit').height(500).toHtml();

Should it be possible to chain transformations this way or am I doing it wrong?

taragano commented 7 years ago

You can do something like the following:

var tr = cloudinary.Transformation.new();
tr.crop('crop').width(1000).height(1000).chain().crop('limit').height(500);
tag = cl.image(cloudinaryId, tr);

Please let me know if this works for you?

ewal commented 7 years ago

Very cool. I'll try it and let you now. Didn't realize that it was possible to pass transformations to the image method that way but in hindsight I could of course have tested.