aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2009-07-11 00:58:19 +0000
committerCash Costello <cash.costello@gmail.com>2009-07-11 00:58:19 +0000
commitd19606b96ba0f5ed56e9e736b8fe88210528577c (patch)
treed8148ae40b56350cf23a74a503b2d759bd32d41d
parentef40f4101aa5653a6697a273806ed4d4537bc91e (diff)
downloadelgg-d19606b96ba0f5ed56e9e736b8fe88210528577c.tar.gz
elgg-d19606b96ba0f5ed56e9e736b8fe88210528577c.tar.bz2
I will probably regret this - opening up imagemagick command line to all
-rw-r--r--docs/configure_server.txt5
-rw-r--r--languages/en.php2
-rw-r--r--lib/resize.php2
-rw-r--r--system.php11
-rw-r--r--views/default/tidypics/forms/admin.php36
5 files changed, 38 insertions, 18 deletions
diff --git a/docs/configure_server.txt b/docs/configure_server.txt
index 057c4ee82..4d77816d6 100644
--- a/docs/configure_server.txt
+++ b/docs/configure_server.txt
@@ -13,11 +13,14 @@ along these lines: "Tidypics warning: user exceeded post limit on image upload"
GD: Elgg requires GD for image resizing. Tidypics uses GD by default for
resizing. There are two versions GD and GD2. It generally does not matter
which one you are using and it isn't always apparent which one you are
-running anyways.
+running anyway.
ImageMagick: A significantly better image library than GD. It uses less
memory during resizing. Use this if it is available.
+exec: Calls to ImageMagick command line utilities like convert require that
+exec() be available. On some servers it will be for security reasons.
+
Memory Available to PHP: The amount of RAM available to a single PHP
process. This can have an effect on how large an image you can resize
(especially if you are running Tidypics with GD). The best place to
diff --git a/languages/en.php b/languages/en.php
index 114fa3eff..76604f543 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -58,7 +58,7 @@
'tidypics:settings:maxfilesize' => "Maximum image size in megabytes (MB):",
'tidypics:settings:quota' => "User/Group Quota (MB) - 0 equals no quota",
'tidypics:settings:watermark' => "Enter text to appear in the watermark - ImageMagick Cmdline must be selected for the image library",
- 'tidypics:settings:im_path' => "Enter the path to your ImageMagick commands",
+ 'tidypics:settings:im_path' => "Enter the path to your ImageMagick commands (with trailing slash)",
'tidypics:settings:img_river_view' => "How many entries in river for each batch of uploaded images",
'tidypics:settings:album_river_view' => "Show the album cover or a set of photos for new album",
'tidypics:settings:largesize' => "Primary image size",
diff --git a/lib/resize.php b/lib/resize.php
index 8561e1f4a..a2c522eb8 100644
--- a/lib/resize.php
+++ b/lib/resize.php
@@ -527,7 +527,7 @@
}
if(substr($im_path, strlen($im_path)-1, 1) != "/") $im_path .= "/";
$command = $im_path . "convert \"$input_name\" -resize ".$newwidth."x".$newheight."^ -gravity center -extent ".$newwidth."x".$newheight." \"$output_name\"";
- system($command);
+ exec($command);
return $output_name;
}
diff --git a/system.php b/system.php
index 833722db8..24295c715 100644
--- a/system.php
+++ b/system.php
@@ -39,6 +39,10 @@
return $size;
}
+ $disablefunc = explode(',', ini_get('disable_functions'));
+ $exec_avail = "Disabled";
+ if (is_callable('exec') && !in_array('exec',$disablefunc))
+ $exec_avail = "Enabled";
ob_start();
@@ -57,11 +61,16 @@
<td>Elgg requires the GD extension to be loaded</td>
</tr>
<tr>
- <td>ImageMagick</td>
+ <td>ImageMagick PHP</td>
<td><?php echo (extension_loaded('imagick')) ? 'Enabled' : 'Disabled'; ?></td>
<td></td>
</tr>
<tr>
+ <td>exec()</td>
+ <td><?php echo $exec_avail; ?></td>
+ <td>Required for ImageMagick command line</td>
+ </tr>
+ <tr>
<td>Memory Available to PHP</td>
<td><?php echo ini_get('memory_limit'); ?>B</td>
<td>Change memory_limit to increase</td>
diff --git a/views/default/tidypics/forms/admin.php b/views/default/tidypics/forms/admin.php
index a80fff91d..0ade3d885 100644
--- a/views/default/tidypics/forms/admin.php
+++ b/views/default/tidypics/forms/admin.php
@@ -12,29 +12,37 @@
$action = $vars['url'] . 'action/tidypics/settings';
$plugin = find_plugin_settings('tidypics');
+
+
+ if (extension_loaded('imagick'))
+ $img_lib_options['ImageMagickPHP'] = 'ImageMagick';
+
+ $disablefunc = explode(',', ini_get('disable_functions'));
+ if (is_callable('exec') && !in_array('exec',$disablefunc))
+ $img_lib_options['ImageMagick'] = 'ImageMagick Cmdline';
+
+ $img_lib_options['GD'] = 'GD';
- // Image Library - need to update values!
+ // Image Library
$image_lib = $plugin->image_lib;
if (!$image_lib) $image_lib = 'GD';
$form_body = '<p>' . elgg_echo('tidypics:settings:image_lib');
$form_body .= elgg_view('input/pulldown', array(
'internalname' => 'params[image_lib]',
- 'options_values' => array(
- 'GD' => 'GD',
- 'ImageMagickPHP' => 'ImageMagick',
-/* 'ImageMagick' => 'ImageMagick Cmdline', */
- ),
+ 'options_values' => $img_lib_options,
'value' => $image_lib
));
- $form_body .= '</p>';
-/*
- // Image Magick Path
- $im_path = $plugin->im_path;
- if(!$im_path) $im_path = "/usr/bin/";
- $form_body .= "<p>" . elgg_echo('tidypics:settings:im_path') . "<br />";
- $form_body .= elgg_view("input/text",array('internalname' => 'params[im_path]', 'value' => $im_path)) . "</p>";
-*/
+ $form_body .= '<br/>Note: If you want to select ImageMagick Command Line, first confirm that it is installed on your server.</p>';
+
+ if (is_callable('exec') && !in_array('exec',$disablefunc)) {
+ // Image Magick Path
+ $im_path = $plugin->im_path;
+ if(!$im_path) $im_path = "/usr/bin/";
+ $form_body .= "<p>" . elgg_echo('tidypics:settings:im_path') . "<br />";
+ $form_body .= elgg_view("input/text",array('internalname' => 'params[im_path]', 'value' => $im_path)) . "</p>";
+ }
+
// Tagging
$tagging = $plugin->tagging;
if(!$tagging) $tagging = "enabled";