PDA

View Full Version : Problem with upload *.jpeg images on add and edit listing.



Viktor
May 8, 2012, 12:34 PM
Hello all,

If you have problems with upload images with jpeg type you can fix it yourself. (if you know php of course :) )

Open file ftp: includes>>classes>>rlCrop.class.php

find method 'saveImage'

and change code from:

switch($ext) {
case 'gif':
if($this->gdInfo['Truecolor Support'] && imageistruecolor($this->_imgFinal))
{
imagetruecolortopalette($this->_imgFinal, false, 255);
}
case 'png':
$saved = $func($this->_imgFinal, $filename);
break;
case 'jpg':
$saved = $func($this->_imgFinal, $filename, $quality);
break;
}

to:


switch($ext) {
case 'gif':
if($this->gdInfo['Truecolor Support'] && imageistruecolor($this->_imgFinal))
{
imagetruecolortopalette($this->_imgFinal, false, 255);
}
case 'png':
$saved = $func($this->_imgFinal, $filename);
break;
case 'jpg':
case 'jpeg':
$saved = $func($this->_imgFinal, $filename, $quality);
break;
}

and find method 'showImage' and change code from:

switch($type) {
case 'gif':
if ($this->gdInfo['Truecolor Support'] && imageistruecolor($this->_imgFinal)) {
imagetruecolortopalette($this->_imgFinal, false, 255);
}
case 'png':
$func($this->_imgFinal);
break;
case 'jpg':
$func($this->_imgFinal, '', $quality);
break;
}

to:


switch($type) {
case 'gif':
if ($this->gdInfo['Truecolor Support'] && imageistruecolor($this->_imgFinal)) {
imagetruecolortopalette($this->_imgFinal, false, 255);
}
case 'png':
$func($this->_imgFinal);
break;
case 'jpg':
case 'jpeg':
$func($this->_imgFinal, '', $quality);
break;
}

Then if you want to delete empty images downloaded before go to ftp and open file: ftp:libs>>upload>>upload.php
Find method 'delete' and find line:


$success = $id == $listing_id && is_file($file_path) && unlink($file_path);

and change to:


$success = $id == $listing_id;
unlink($file_path);

Chris Brown
May 9, 2012, 09:49 PM
I have done this and tested with a jpeg image and it now works fine for me

Aitoruax
June 4, 2012, 05:21 PM
Thank you Viktor, really usefull, i had some problems maybe this is the key

John
July 25, 2012, 10:56 AM
Hi Folks,
Thanks to Viktor, really helpful fix, btw this fix already applied to Flynax 4.1 version!

John