// Fixed upload of the logo in the installer

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@16982 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
dMetzger
2012-08-23 17:47:03 +00:00
parent 0489bf4945
commit f9a0664810
+16 -4
View File
@@ -125,12 +125,24 @@ class InstallControllerHttpConfigure extends InstallControllerHttp
$newwidth = $width * $percent;
$newheight = $height * $percent;
if (!is_writable(_PS_ROOT_DIR_.'/img/'))
$error = $this->l('Image folder %s is not writable', _PS_ROOT_DIR_.'/img/');
if (!$error)
if (!is_writable(_PS_ROOT_DIR_.'/img/'))
$error = $this->l('Image folder %s is not writable', _PS_ROOT_DIR_.'/img/');
else if (!@ImageManager::resize($tmp_name, _PS_IMG_DIR_.'logo.jpg', $newwidth, $newheight))
{
list($src_width, $src_height, $type) = getimagesize($tmp_name);
$src_image = ImageManager::create($type, $tmp_name);
$dest_image = imagecreatetruecolor($src_width, $src_height);
$white = imagecolorallocate($dest_image, 255, 255, 255);
imagefilledrectangle($dest_image, 0, 0, $src_width, $src_height, $white);
imagecopyresampled($dest_image, $src_image, 0, 0, 0, 0, $src_width, $src_height, $src_width, $src_height);
if (!imagejpeg($dest_image, _PS_ROOT_DIR_.'/img/logo.jpg', 95))
$error = $this->l('An error occurred during logo copy.');
else
{
imagedestroy($dest_image);
@chmod($filename, 0664);
}
}
}
else
$error = $this->l('An error occurred during logo upload.');