mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-02 01:52:10 +09:00
#18400897 : check gd functions existence before using them
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@6898 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
e3eaf8de97
commit
fd50fdd9e3
1 changed files with 8 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue