mirror of
https://github.com/e107inc/e107.git
synced 2025-08-02 12:48:26 +02:00
Bugtracker #4264 - see if we can prevent fatal errors in resize_handler
This commit is contained in:
@@ -11,8 +11,8 @@
|
|||||||
| GNU General Public License (http://gnu.org).
|
| GNU General Public License (http://gnu.org).
|
||||||
|
|
|
|
||||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/resize_handler.php,v $
|
| $Source: /cvs_backup/e107_0.8/e107_handlers/resize_handler.php,v $
|
||||||
| $Revision: 1.6 $
|
| $Revision: 1.7 $
|
||||||
| $Date: 2007-10-10 21:34:44 $
|
| $Date: 2007-12-20 20:51:17 $
|
||||||
| $Author: e107steved $
|
| $Author: e107steved $
|
||||||
|
|
|
|
||||||
| Mod to give correct return code if source image already smaller than max size
|
| Mod to give correct return code if source image already smaller than max size
|
||||||
@@ -117,19 +117,19 @@ function resize_image($source_file, $destination_file, $type = "upload", $model
|
|||||||
// exec ($pref['im_path']."convert -quality ".$im_quality." -antialias -geometry ".$new_size."x".$new_imageheight." ".escapeshellarg($source_file)." '".$destination_file."'");
|
// exec ($pref['im_path']."convert -quality ".$im_quality." -antialias -geometry ".$new_size."x".$new_imageheight." ".escapeshellarg($source_file)." '".$destination_file."'");
|
||||||
exec ($pref['im_path']."convert -quality ".$im_quality." -antialias -geometry ".$new_size."x".$new_imageheight." ".escapeshellarg($source_file)." \"".$destination_file."\"");
|
exec ($pref['im_path']."convert -quality ".$im_quality." -antialias -geometry ".$new_size."x".$new_imageheight." ".escapeshellarg($source_file)." \"".$destination_file."\"");
|
||||||
}
|
}
|
||||||
break:
|
break;
|
||||||
case "gd1" :
|
case "gd1" :
|
||||||
switch ($image_stats[2])
|
switch ($image_stats[2])
|
||||||
{
|
{
|
||||||
case IMAGETYPE_PNG : // 3 - PNG
|
case IMAGETYPE_PNG : // 3 - PNG
|
||||||
$src_img = imagecreatefrompng($source_file);
|
$src_img = @imagecreatefrompng($source_file);
|
||||||
break;
|
break;
|
||||||
case IMAGETYPE_GIF : // 1 - GIF
|
case IMAGETYPE_GIF : // 1 - GIF
|
||||||
if (!function_exists('imagecreatefromgif')) return FALSE; // Some versions of GD library don't support GIF
|
if (!function_exists('imagecreatefromgif')) return FALSE; // Some versions of GD library don't support GIF
|
||||||
$src_img = imagecreatefromgif($source_file);
|
$src_img = @imagecreatefromgif($source_file);
|
||||||
break;
|
break;
|
||||||
case IMAGETYPE_JPEG : // 2 - Jpeg
|
case IMAGETYPE_JPEG : // 2 - Jpeg
|
||||||
$src_img = imagecreatefromjpeg($source_file);
|
$src_img = @imagecreatefromjpeg($source_file);
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
return FALSE; // Unsupported image type
|
return FALSE; // Unsupported image type
|
||||||
@@ -164,14 +164,14 @@ function resize_image($source_file, $destination_file, $type = "upload", $model
|
|||||||
switch ($image_stats[2])
|
switch ($image_stats[2])
|
||||||
{
|
{
|
||||||
case IMAGETYPE_PNG : // 3 - PNG
|
case IMAGETYPE_PNG : // 3 - PNG
|
||||||
$src_img = imagecreatefrompng($source_file);
|
$src_img = @imagecreatefrompng($source_file);
|
||||||
break;
|
break;
|
||||||
case IMAGETYPE_GIF : // 1 - GIF
|
case IMAGETYPE_GIF : // 1 - GIF
|
||||||
if (!function_exists('imagecreatefromgif')) return FALSE; // Some versions of GD library don't support GIF
|
if (!function_exists('imagecreatefromgif')) return FALSE; // Some versions of GD library don't support GIF
|
||||||
$src_img = imagecreatefromgif($source_file);
|
$src_img = @imagecreatefromgif($source_file);
|
||||||
break;
|
break;
|
||||||
case IMAGETYPE_JPEG : // 2 - Jpeg
|
case IMAGETYPE_JPEG : // 2 - Jpeg
|
||||||
$src_img = imagecreatefromjpeg($source_file);
|
$src_img = @imagecreatefromjpeg($source_file);
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
return FALSE; // Unsupported image type
|
return FALSE; // Unsupported image type
|
||||||
|
Reference in New Issue
Block a user