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 05, 2009, 22:10:33 PM

Title: [FIXED] Bug in ps_product_files.php
Post by: doorknob on May 05, 2009, 22:10:33 PM
The function vmImageTools::resizeImage() is called from two places in ps_product_files:
line 567:      vmImageTools::resizeImage( $uploaddir.$d['filename'], $uploaddir.$d['filename'], $width, $height );
line 837:   vmImageTools::ResizeImage( $fileName, $fileout, $height, $width );


Spot the difference?
in line 567 the height and width are the wrong way round. The function expects height before width
function resizeImage($sourceFile, $resizedFile, $height, $width, $enlargeSmallerImg=false )

I suspect that this has gone unnoticed because most users set the same value for height and width for resize of thumbnails. I only noticed because I am using the same function to also set max dimensions on the main image, which I have set with different height and width.
Line 567 should be
line 567:      vmImageTools::resizeImage( $uploaddir.$d['filename'], $uploaddir.$d['filename'], $height, $width );


J1.5.10, VM 1.1.3 (build 1723)

Regards
Phil
Title: Re: Bug in ps_product_files.php
Post by: aravot on May 06, 2009, 00:00:14 AM
I could be wrong but I think one is for regular image upload.

(http://www.protechsystems.us/stuff/joomla/vm/vm-width-height.gif)


The other or additional image upload.

(http://www.protechsystems.us/stuff/joomla/vm/vm-height-width.gif)
Title: Re: Bug in ps_product_files.php
Post by: doorknob on May 06, 2009, 00:30:32 AM
It doesn't matter what it's used for. The parameters are the wrong way round.
Title: Re: Bug in ps_product_files.php
Post by: aravot on May 06, 2009, 00:33:27 AM
If you see the image for additional image height is before width however I will ask Soeren, and fix it if it is a bug.

Thanks for continues support.
Title: Re: Bug in ps_product_files.php
Post by: mdaastani on September 13, 2009, 09:18:59 AM
Quote from: aravot on May 06, 2009, 00:00:14 AM
I could be wrong but I think one is for regular image upload.

(http://www.protechsystems.us/stuff/joomla/vm/vm-width-height.gif)


I don't have three choices below layout:
Enable Dynamic Thumbnail Resizing...
Thumbnail image...
Thumbnail image

my virtue is 1.1.2
plz guide
Title: Re: Bug in ps_product_files.php
Post by: aravot on September 13, 2009, 09:28:10 AM
Instead of hijacking thread, READ the manual http://virtuemart.net/documentation/User_Manual/Product_Files_and_Images.html#N210B4 please.
Title: Re: Bug in ps_product_files.php
Post by: steph.s on September 13, 2009, 23:06:24 PM
In your post the code:

line 567:      vmImageTools::resizeImage( $uploaddir.$d['filename'], $uploaddir.$d['filename'], $width, $height );
line 837:   vmImageTools::ResizeImage( $fileName, $fileout, $height, $width );


you are right that the variable are in the wrong order and also the function is called by resizeImage in one and ResizeImage in the other, it should be resizeImage in both since the function is named resizeImage.

function resizeImage($sourceFile, $resizedFile, $height, $width, $enlargeSmallerImg=false )
Title: Re: Bug in ps_product_files.php
Post by: Soeren on September 14, 2009, 10:32:43 AM
thanks for your fix! I have implemented the change in the latest SVN version.

ciao, Sören