VirtueMart Forum

VirtueMart Dev/Coding Central: VM1 (old version) => Quality & Testing VirtueMart 1.1.x => Virtuemart 1.1 Development (Archiv) => Q&T Resolved => Topic started by: doorknob on May 06, 2009, 00:55:06 AM

Title: Bug in class.img2thumb.php
Post by: doorknob on May 06, 2009, 00:55:06 AM
When an image is being resized, the logic used to decide whether to apply the max height or the max width is too simplistic and can cause the image to be resized incorrectly. Line 191
if ($orig_size[0]<$orig_size[1])

simply determines whether the image is 'landscape' or 'portrait' and uses this to decide whether to apply max width or max height. I use this function to resize images when adding products and when an original image 958x663 was resized using max width of 300 and max height 200, it resized the image to 300x207. It should have resized it to 288x200. The line of code should be
if (($orig_size[0]*$maxY)<($orig_size[1]*$maxX))

This version uses the correct algorithm to resize images whether they are portrait or landscape.

Using J1.5.10 vm 1.1.3 (build 1723)

Regards
Phil