Portrait and Landscape images?

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

I’m going to let users upload images but there’s no
way to figure out if the image is portrait or landscape,

Somehow I need an Image to be
180 width x 135 height if its landscape 135 width x 180 height if its portrait

is this possible in an assemble?

Hey Allan,
well you could resize all images to 180x180 using the “fit” resize strategy. This would make sure that either width or height is 180px at the maximum. If all your images are in the proper aspect ratio already, the other part (width or height) should automatically turn to 135px. This is because “fit” preserves aspect ratio.

Let me know if this works for you.

Kind regards,
Tim

Works perfectly,

I couldn’t really tell from the docs that this is the outcome of “fit” knowing it will conform to the maximum heights and widths.

All makes sense now

Cool glad to help.

I will think about adding this to the documentation. It’s probably a common use case.

Kind regards,
Tim