Master dimension

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

Hello,

When resizing images how can I set a master dimension?
What I mean is if there is a way of making sure that the width is always for example 50 pixels?

Hey Daniel,

you need to use the proper value for the resize_strategy parameter.

Check here: http://transloadit.com/docs/image-resize

It sounds like you want to use “pad”.

Kind regards,
Tim

Well, it is not exactly what I am looking for. For example if I need all my images to be exactly 200 pixels wide but the height does not matter I would set the master dim to width. Is this possible?

Hey Daniel,

well you could use the resize_strategy “fit” and just set a very big height setting, like 9999. This would take the specified width as the maximum possible width, resize the image according to it, but preserve aspect ratio.

Kind regards
Tim

Won´t the image get stretched then?

As I said, “fit” preserves aspect ration.

Closing for now. Let me know if this worked out for you Daniel.