summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--conf/dokuwiki.php2
-rw-r--r--inc/format.php10
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)) {