From 825ec23293e024eec12550b41e87d006e9419248 Mon Sep 17 00:00:00 2001 From: andi Date: Tue, 1 Feb 2005 20:56:37 +0100 Subject: gdlib config option (fixes #106) darcs-hash:20050201195637-9977f-0b793fe383ace1b8ecb0569ce8fb6a4fe404c84f.gz --- inc/format.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'inc') diff --git a/inc/format.php b/inc/format.php index 712d66f34..516cb8071 100644 --- a/inc/format.php +++ b/inc/format.php @@ -497,8 +497,9 @@ function img_cache(&$csrc,&$src,&$w,&$h,$nocache){ * @author Andreas Gohr */ function img_resize($ext,$from,$from_w,$from_h,$to,$to_w,$to_h){ - // create cachedir - io_makeFileDir($to); + global $conf; + + if($conf['gdlib'] < 1) return false; //no GDlib available or wanted // create an image of the given filetype if ($ext == 'jpg' || $ext == 'jpeg'){ @@ -513,12 +514,15 @@ function img_resize($ext,$from,$from_w,$from_h,$to,$to_w,$to_h){ } if(!$image) return false; - if(function_exists("imagecreatetruecolor")){ + if(($conf['gdlib']>1) && function_exists("imagecreatetruecolor")){ $newimg = @imagecreatetruecolor ($to_w, $to_h); } if(!$newimg) $newimg = @imagecreate($to_w, $to_h); if(!$newimg) return false; + // create cachedir + io_makeFileDir($to); + //try resampling first if(function_exists("imagecopyresampled")){ if(!@imagecopyresampled($newimg, $image, 0, 0, 0, 0, $to_w, $to_h, $from_w, $from_h)) { -- cgit v1.2.3