Author Topic: Bug in class.img2thumb.php  (Read 5424 times)

doorknob

  • Jr. Member
  • **
  • Posts: 151
Bug in class.img2thumb.php
« 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
Code: [Select]
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
Code: [Select]
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