--- Mijn iMac:Users:Stefan:Desktop:drupal:includes:image.inc 2005-03-10 16:38:51.%N +0100 +++ Mijn iMac:Applications:MAMP:htdocs:drupal:includes:image.inc 2005-03-13 13:40:42.%N +0100 @@ -57,7 +57,8 @@ return call_user_func_array($function, $params); } else { - drupal_set_message(t('%method is not supported by %toolkit.', array('%method' => "$method", '%toolkit' => "$toolkit"))); + drupal_set_message(t('Due to a server misconfiguration, the image can not be processed correctly.'), 'error'); + watchdog('php', t("The selected image manipulation toolkit '%toolkit' can not correctly process '%function'.", array('%toolkit' => "$toolkit", '%function' => "$function")), WATCHDOG_ERROR); } } } @@ -161,18 +162,24 @@ } /** - * GD Toolkit functions + * GD 2 Toolkit functions + * With the minimal requirements of PHP 4.3 for Drupal, we use the build-in version of GD 2.0 */ /** - * Verify GD settings (that the extension is actually installed). + * Verify GD 2 settings (that the right version is actually installed). */ function image_gd_settings() { - if (!extension_loaded('gd')) { - drupal_set_message(t('Unable to load the GD toolkit'), 'error'); + if ($check = get_extension_funcs('gd')) { + if (in_array('imagegd2', $check)) { + // GD 2 support + return true; + } + } + else { + watchdog('php', t('To make advantage of image manipulation, we recommend installing GD 2, ImageMagick or another supported image manipulation tool for PHP.'), WATCHDOG_NOTICE); return false; } - return true; } /** @@ -193,21 +200,8 @@ return false; } - // GD1 doesn't have true color - if (function_exists('imageCreateTrueColor')) { - $res = imageCreateTrueColor($width, $height); - } - else { - $res = imageCreate($width, $height); - } - - // GD1 doesn't have copyResampled - if (function_exists('imageCopyResampled')) { - imageCopyResampled($res, $im, 0, 0, 0, 0, $width, $height, $info['width'], $info['height']); - } - else { - imageCopyResized($res, $im, 0, 0, 0, 0, $width, $height, $info['width'], $info['height']); - } + $res = imageCreateTrueColor($width, $height); + imageCopyResampled($res, $im, 0, 0, 0, 0, $width, $height, $info['width'], $info['height']); $result = image_gd_close($res, $destination, $info['extension']); imageDestroy($res); @@ -235,7 +229,6 @@ } $res = imageRotate($im, $degrees, $bg_color); - $result = image_gd_close($res, $destination, $info['extension']); return $result; @@ -251,17 +244,8 @@ } $im = image_gd_open($source, $info['extension']); - - // GD1 doesn't have true color - if (function_exists('imageCreateTrueColor')) { - $res = imageCreateTrueColor($width, $height); - } - else { - $res = imageCreate($width, $height); - } - + $res = imageCreateTrueColor($width, $height); imageCopy($im, $res, 0, 0, $x, $y, $width, $height); - $result = image_gd_close($res, $destination, $info['extension']); imageDestroy($res);