News:

Support the VirtueMart project and become a member

Main Menu

Bug in class.img2thumb.php

Started by doorknob, May 06, 2009, 00:55:06 AM

Previous topic - Next topic

doorknob

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