cloudinary/pkg-cloudinary-core

Can't chain transformations on `imageTag`

Closed this issue · 2 comments

ewal commented

(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?

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

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.