]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
I will probably regret this - opening up imagemagick command line to all
authorCash Costello <cash.costello@gmail.com>
Sat, 11 Jul 2009 00:58:19 +0000 (00:58 +0000)
committerCash Costello <cash.costello@gmail.com>
Sat, 11 Jul 2009 00:58:19 +0000 (00:58 +0000)
docs/configure_server.txt
languages/en.php
lib/resize.php
system.php
views/default/tidypics/forms/admin.php

index 057c4ee82e9e28589c922cb05df983cb7dca32a4..4d77816d624f9402b1bf5c621e8487f834b1e2c3 100644 (file)
@@ -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 \r
 resizing. There are two versions GD and GD2. It generally does not matter \r
 which one you are using and it isn't always apparent which one you are\r
-running anyways.\r
+running anyway.\r
 \r
 ImageMagick: A significantly better image library than GD. It uses less \r
 memory during resizing. Use this if it is available.\r
 \r
+exec: Calls to ImageMagick command line utilities like convert require that\r
+exec() be available. On some servers it will be for security reasons.\r
+\r
 Memory Available to PHP: The amount of RAM available to a single PHP \r
 process. This can have an effect on how large an image you can resize\r
 (especially if you are running Tidypics with GD). The best place to\r
index 114fa3effdb25f4689e4c916bdf7734329318b59..76604f543d6ff37a37bf97b4b89987e025f34efb 100644 (file)
@@ -58,7 +58,7 @@
                        'tidypics:settings:maxfilesize' => "Maximum image size in megabytes (MB):",\r
                        'tidypics:settings:quota' => "User/Group Quota (MB) - 0 equals no quota",\r
                        'tidypics:settings:watermark' => "Enter text to appear in the watermark - ImageMagick Cmdline must be selected for the image library",\r
-                       'tidypics:settings:im_path' => "Enter the path to your ImageMagick commands",\r
+                       'tidypics:settings:im_path' => "Enter the path to your ImageMagick commands (with trailing slash)",\r
                        'tidypics:settings:img_river_view' => "How many entries in river for each batch of uploaded images",\r
                        'tidypics:settings:album_river_view' => "Show the album cover or a set of photos for new album",\r
                        'tidypics:settings:largesize' => "Primary image size",\r
index 8561e1f4a8f171b1ebb7b5031db5fe23318cd120..a2c522eb8f6be32cae45b0b3a61f344f2c657d94 100644 (file)
                                }\r
                                if(substr($im_path, strlen($im_path)-1, 1) != "/") $im_path .= "/";\r
                                $command = $im_path . "convert \"$input_name\" -resize ".$newwidth."x".$newheight."^ -gravity center -extent ".$newwidth."x".$newheight." \"$output_name\"";\r
-                               system($command);\r
+                               exec($command);\r
                                return $output_name;\r
 \r
                        }\r
index 833722db8a76deffe9517b8da82938f40cacc877..24295c7152562cd7319b90e3fe8a2276ea5a585d 100644 (file)
        return $size;
        }
 
+       $disablefunc = explode(',', ini_get('disable_functions'));
+       $exec_avail = "Disabled";
+       if (is_callable('exec') && !in_array('exec',$disablefunc))
+               $exec_avail = "Enabled";
 
        ob_start();
 
                        <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>
index a80fff91dc51c21a7263534693a6d57b1128e5a5..0ade3d885fe46e23de7cf8aad387f2d90442ec41 100644 (file)
        $action = $vars['url'] . 'action/tidypics/settings';\r
        \r
        $plugin = find_plugin_settings('tidypics');\r
+       \r
+       \r
+       if (extension_loaded('imagick'))\r
+               $img_lib_options['ImageMagickPHP'] = 'ImageMagick';\r
+               \r
+       $disablefunc = explode(',', ini_get('disable_functions'));\r
+       if (is_callable('exec') && !in_array('exec',$disablefunc))\r
+               $img_lib_options['ImageMagick'] = 'ImageMagick Cmdline';\r
+\r
+       $img_lib_options['GD'] = 'GD';\r
 \r
 \r
-       // Image Library - need to update values!\r
+       // Image Library\r
        $image_lib = $plugin->image_lib;\r
        if (!$image_lib) $image_lib = 'GD';\r
        $form_body = '<p>' . elgg_echo('tidypics:settings:image_lib');\r
        $form_body .= elgg_view('input/pulldown', array(\r
                                        'internalname' => 'params[image_lib]',\r
-                                       'options_values' => array(\r
-                                               'GD' => 'GD',\r
-                                               'ImageMagickPHP' => 'ImageMagick',\r
-/*                                             'ImageMagick' => 'ImageMagick Cmdline', */\r
-                                       ),\r
+                                       'options_values' => $img_lib_options,\r
                                        'value' => $image_lib\r
        ));\r
-       $form_body .= '</p>';\r
-/*\r
-       // Image Magick Path\r
-       $im_path = $plugin->im_path;\r
-       if(!$im_path) $im_path = "/usr/bin/";\r
-       $form_body .= "<p>" . elgg_echo('tidypics:settings:im_path') . "<br />";\r
-       $form_body .= elgg_view("input/text",array('internalname' => 'params[im_path]', 'value' => $im_path)) . "</p>";\r
-*/\r
+       $form_body .= '<br/>Note: If you want to select ImageMagick Command Line, first confirm that it is installed on your server.</p>';\r
+\r
+       if (is_callable('exec') && !in_array('exec',$disablefunc)) {\r
+               // Image Magick Path\r
+               $im_path = $plugin->im_path;\r
+               if(!$im_path) $im_path = "/usr/bin/";\r
+               $form_body .= "<p>" . elgg_echo('tidypics:settings:im_path') . "<br />";\r
+               $form_body .= elgg_view("input/text",array('internalname' => 'params[im_path]', 'value' => $im_path)) . "</p>";\r
+       }\r
+\r
        // Tagging\r
        $tagging = $plugin->tagging;\r
        if(!$tagging) $tagging = "enabled";\r