diff options
author | andi <andi@splitbrain.org> | 2005-02-01 20:56:37 +0100 |
---|---|---|
committer | andi <andi@splitbrain.org> | 2005-02-01 20:56:37 +0100 |
commit | 825ec23293e024eec12550b41e87d006e9419248 (patch) | |
tree | afba77862ffe838e5108e94bd8d42b11f9d63dbb | |
parent | 28fb55ffad18550ed855570ce3e77884a9a8ab27 (diff) | |
download | rpg-825ec23293e024eec12550b41e87d006e9419248.tar.gz rpg-825ec23293e024eec12550b41e87d006e9419248.tar.bz2 |
gdlib config option (fixes #106)
darcs-hash:20050201195637-9977f-0b793fe383ace1b8ecb0569ce8fb6a4fe404c84f.gz
-rw-r--r-- | conf/dokuwiki.php | 2 | ||||
-rw-r--r-- | inc/format.php | 10 |
2 files changed, 8 insertions, 4 deletions
diff --git a/conf/dokuwiki.php b/conf/dokuwiki.php index e2f5319ac..3af176ae6 100644 --- a/conf/dokuwiki.php +++ b/conf/dokuwiki.php @@ -62,7 +62,7 @@ $conf['purgeonadd'] = 1; //purge cache when a new file is added $conf['locktime'] = 15*60; //maximum age for lockfiles (defaults to 15 minutes) $conf['notify'] = ''; //send change info to this email (leave blank for nobody) $conf['mailfrom'] = ''; //use this email when sending mails - +$conf['gdlib'] = 2; //the GDlib version (0, 1 or 2) 2 tries to autodetect //Set target to use when creating links - leave empty for same window $conf['target']['wiki'] = ''; 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 <andi@splitbrain.org> */ 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)) { |