News:

Looking for documentation? Take a look on our wiki

Main Menu

[FIXED] Bug in ps_product_files.php

Started by doorknob, May 05, 2009, 22:10:33 PM

Previous topic - Next topic

doorknob

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

aravot

I could be wrong but I think one is for regular image upload.




The other or additional image upload.


doorknob

It doesn't matter what it's used for. The parameters are the wrong way round.

aravot

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.

mdaastani

#4
Quote from: aravot on May 06, 2009, 00:00:14 AM
I could be wrong but I think one is for regular image upload.




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

my virtue is 1.1.2
plz guide


steph.s

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 )

Soeren

thanks for your fix! I have implemented the change in the latest SVN version.

ciao, Sören
The future of eCommerce: VirtueMart & Joomla!
http://virtuemart.net