Now it's only possible to resize images to a specific size. It would be great to have the possibility to resize to a 1-dimension size and the rest of the image to resize proportionally to that dimension.
I mean:
Image size: 1024x768
1-dimension size: 800
So, the image is resized to: 800x600
or
Image size: 1024x1280
1-dimension size: 800
So, the image is resized to: 640x800
Thanks again!
Comments
Comment #1
AlexisWilke commentedThe size constraint is taken in account and the image resized keeping the ratio.
More or less, it uses the width to compute the height and if the result is still too large, it uses the height to compute the width. The result is that the final image always fits the specified width and height. You could increase the side that you want to "generally" ignore: 1000000x800.
Although the truth is I probably impose a maximum to both width and height, but that would be the idea.
Let me know whether that works for you.
Thank you.
Alexis Wilke
Comment #2
jayperkor commentedHi Alexis!
The issue is that images that do not fit to the specified size (i.e., 1024x768) are cropped and I want them to be resized to fit inside the 1024x768 boundaries (1-dimension proportional images).
For now, I am using this crappy patch against gallerix.build.inc as workaround:
540,550d539
< // Crappy workaround to avoid images being cropped
< $calc_source_ratio = $in_width / $in_height;
< $calc_destin_ratio = $out_width / $out_height;
< if ($calc_destin_ratio > $calc_source_ratio) {
< $out_height = $properties['height'];
< $out_width = (int)round ($out_height * $calc_source_ratio);
< } else {
< $out_width = $properties['width'];
< $out_height = (int)round ($out_width / $calc_source_ratio);
< }
and more or less it does the job for me. Maybe there are better ideas as how to implement this...
And, yes, the gallery's images do not have same sizes and could look ugly but I can afford that. :)
Thanks!