From fd50fdd9e3523f75d8d442160b1a955ccf972bde Mon Sep 17 00:00:00 2001 From: haneul Date: Wed, 28 Oct 2009 06:46:44 +0000 Subject: [PATCH] #18400897 : check gd functions existence before using them git-svn-id: http://xe-core.googlecode.com/svn/sandbox@6898 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- classes/file/FileHandler.class.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/classes/file/FileHandler.class.php b/classes/file/FileHandler.class.php index da3808613..4f518b57c 100644 --- a/classes/file/FileHandler.class.php +++ b/classes/file/FileHandler.class.php @@ -470,20 +470,24 @@ // create temporary image having original type switch($type) { case 'gif' : + if(!function_exists('imagecreatefromgif')) return false; $source = @imagecreatefromgif($source_file); break; // jpg case 'jpeg' : case 'jpg' : + if(!function_exists('imagecreatefromjpeg')) return false; $source = @imagecreatefromjpeg($source_file); break; // png case 'png' : + if(!function_exists('imagecreatefrompng')) return false; $source = @imagecreatefrompng($source_file); break; // bmp case 'wbmp' : case 'bmp' : + if(!function_exists('imagecreatefromwbmp')) return false; $source = @imagecreatefromwbmp($source_file); break; default : @@ -514,17 +518,21 @@ // write into the file switch($target_type) { case 'gif' : + if(!function_exists('imagegif')) return false; $output = @imagegif($thumb, $target_file); break; case 'jpeg' : case 'jpg' : + if(!function_exists('imagejpeg')) return false; $output = @imagejpeg($thumb, $target_file, 100); break; case 'png' : + if(!function_exists('imagepng')) return false; $output = @imagepng($thumb, $target_file, 9); break; case 'wbmp' : case 'bmp' : + if(!function_exists('imagewbmp')) return false; $output = @imagewbmp($thumb, $target_file, 100); break; }