aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2010-03-06 23:01:19 +0000
committerCash Costello <cash.costello@gmail.com>2010-03-06 23:01:19 +0000
commita34144019c09311561a1b209bced308095b833a0 (patch)
treec85579f7fcf9f7c41d49db827dd4d1cef407bc0f
parent8f6d4a6a36a9f00242ffe368a3d9e306c7e3a837 (diff)
downloadelgg-a34144019c09311561a1b209bced308095b833a0.tar.gz
elgg-a34144019c09311561a1b209bced308095b833a0.tar.bz2
better error checking for imagemagick
-rw-r--r--lib/resize.php23
1 files changed, 17 insertions, 6 deletions
diff --git a/lib/resize.php b/lib/resize.php
index 250511d66..fdc321ab1 100644
--- a/lib/resize.php
+++ b/lib/resize.php
@@ -406,8 +406,9 @@
$image_sizes['thumb_image_width'],
$image_sizes['thumb_image_height'],
true);
- if (!$rtn_code)
+ if (!$rtn_code) {
return false;
+ }
$file->thumbnail = $prefix."thumb".$filestorename;
@@ -419,8 +420,9 @@
$image_sizes['small_image_width'],
$image_sizes['small_image_height'],
true);
- if (!$rtn_code)
+ if (!$rtn_code) {
return false;
+ }
$file->smallthumb = $prefix."smallthumb".$filestorename;
@@ -432,8 +434,9 @@
$image_sizes['large_image_width'],
$image_sizes['large_image_height'],
false);
- if (!$rtn_code)
+ if (!$rtn_code) {
return false;
+ }
$file->largethumb = $prefix."largethumb".$filestorename;
@@ -537,13 +540,21 @@
// see imagemagick web site for explanation of these parameters
// the ^ in the resize means those are minimum width and height values
$command = $im_path . "convert \"$input_name\" -resize ".$newwidth."x".$newheight."^ -gravity center -extent ".$newwidth."x".$newheight." \"$output_name\"";
- exec($command);
+ $output = array();
+ $ret = 0;
+ exec($command, $output, $ret);
+ if ($ret == 127) {
+ trigger_error('Tidypics warning: Image Magick convert is not found', E_USER_WARNING);
+ return false;
+ } else if ($ret > 0) {
+ trigger_error('Tidypics warning: Image Magick convert failed', E_USER_WARNING);
+ return false;
+ }
return true;
-
}
}
return false;
}
-?>
+?> \ No newline at end of file