summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Wittens <steven@10.no-reply.drupal.org>2005-02-21 04:16:46 +0000
committerSteven Wittens <steven@10.no-reply.drupal.org>2005-02-21 04:16:46 +0000
commite9f14b70d20c9f4e5247ea51b8a5c5287381c788 (patch)
tree9d4f2fea93cfe4d96119eaa16acc647ff438d6fd
parent59e86f61b7100e6f9c7535889221645354f94e04 (diff)
downloadbrdo-e9f14b70d20c9f4e5247ea51b8a5c5287381c788.tar.gz
brdo-e9f14b70d20c9f4e5247ea51b8a5c5287381c788.tar.bz2
#17477: Remove dependency on GD for avatar uploading.
-rw-r--r--includes/image.inc23
1 files changed, 14 insertions, 9 deletions
diff --git a/includes/image.inc b/includes/image.inc
index b485496d7..4f852e4bc 100644
--- a/includes/image.inc
+++ b/includes/image.inc
@@ -32,7 +32,10 @@ function image_get_toolkit() {
if (!$toolkit) {
$toolkit = variable_get('image_toolkit', 'gd');
if ($toolkit != 'gd') {
- include_once 'includes/image.'.$toolkit.'.inc';
+ include_once 'includes/image.'. $toolkit .'.inc';
+ }
+ elseif (!image_gd_settings()) {
+ $toolkit = false;
}
}
@@ -48,14 +51,14 @@ function image_get_toolkit() {
* @return Mixed values (typically Boolean for successful operation)
*/
function image_toolkit_invoke($method, $params = array()) {
- $toolkit = image_get_toolkit();
-
- $function = 'image_' . $toolkit . '_'. $method;
- if (function_exists($function)) {
- return call_user_func_array($function, $params);
- }
- else {
- drupal_set_message(t('%method is not supported by %toolkit.', array('%method' => "<em>$method</em>", '%toolkit' => "<em>$toolkit</em>")));
+ if ($toolkit = image_get_toolkit()) {
+ $function = 'image_'. $toolkit .'_'. $method;
+ if (function_exists($function)) {
+ return call_user_func_array($function, $params);
+ }
+ else {
+ drupal_set_message(t('%method is not supported by %toolkit.', array('%method' => "<em>$method</em>", '%toolkit' => "<em>$toolkit</em>")));
+ }
}
}
@@ -167,7 +170,9 @@ function image_crop($source, $destination, $x, $y, $width, $height) {
function image_gd_settings() {
if (!extension_loaded('gd')) {
drupal_set_message(t('Unable to load the GD toolkit'), 'error');
+ return false;
}
+ return true;
}
/**