image resize to only enlarge if smaller than dimensions

Archived from the Transloadit support forum. Originally posted on June 13, 2013; details may be outdated, see our docs for current behavior. Original thread

I’m not sure how to setup a template to do the following:

if the image is less than 500px on a side, resize the image up to 500px on a side, keeping the aspect ratio
if the image has a side >= 500px, don’t resize it

It appears to me that resize_strategy: fit and zoom: true will do the first, but will also shrink large images down to 500px.

Is this possible with the transloadit platform?

Thanks.

Hey Donald,

you could try using the /file/filter robot to pipe images to different steps depending on their dimensions. The variables you need to examine are ${file.meta.width} and ${file.meta.height}.

Here are the docs for the robot: https://transloadit.com/docs/file-filter

Please let me know if you need further help.

Kind regards,
Tim

Co-Founder Transloadit
@tim_kos