]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
added a tab to admin page for testing image magick location
authorCash Costello <cash.costello@gmail.com>
Wed, 26 Aug 2009 01:13:57 +0000 (01:13 +0000)
committerCash Costello <cash.costello@gmail.com>
Wed, 26 Aug 2009 01:13:57 +0000 (01:13 +0000)
actions/imtest.php [new file with mode: 0644]
languages/en.php
views/default/tidypics/admin/imagelib.php [new file with mode: 0644]
views/default/tidypics/admin/tidypics.php
views/default/tidypics/forms/settings.php

diff --git a/actions/imtest.php b/actions/imtest.php
new file mode 100644 (file)
index 0000000..6ab2b7b
--- /dev/null
@@ -0,0 +1,19 @@
+<?php\r
+       /**\r
+        * Tisypics ImageMagick Location Test\r
+        *\r
+        *  Called through ajax\r
+        */\r
+        \r
+       $location = $_GET['location'];\r
+       \r
+       $command = $location . "convert -version";\r
+       \r
+       $result = system($command, $return_val);\r
+       \r
+       if ($return_val == 0) {\r
+               echo $result;\r
+       } else {\r
+               echo "Unable to run ImageMagick. Please check the path.";\r
+       }\r
+?>\r
index 82305d2aa1c6f6e8b0763fb744985abae26622d1..674c712078d3368e5eb357ea4f6563fb7b0bf0d5 100644 (file)
@@ -51,7 +51,7 @@
                //settings\r
                        'tidypics:settings' => 'Settings',\r
                        'tidypics:admin:instructions' => 'These are the core Tidypics settings. Change them for your setup and then click save.',\r
-                       'tidypics:settings:image_lib' => "Image Library",\r
+                       'tidypics:settings:image_lib' => "Image Library",\r
                        'tidypics:settings:download_link' => "Show download link",\r
                        'tidypics:settings:tagging' => "Enable photo tagging",\r
                        'tidypics:settings:photo_ratings' => "Enable photo ratings (requires rate plugin of Miguel Montes or compatible)",\r
diff --git a/views/default/tidypics/admin/imagelib.php b/views/default/tidypics/admin/imagelib.php
new file mode 100644 (file)
index 0000000..8f71c75
--- /dev/null
@@ -0,0 +1,60 @@
+<?php\r
+\r
+       $img_type = get_subtype_id('object', 'image');\r
+       $query = "SELECT count(guid) as total from {$CONFIG->dbprefix}entities where subtype={$img_type}";\r
+       $total = get_data_row($query);\r
+       $num_images = $total->total;\r
+       \r
+       $img_type = get_subtype_id('object', 'album');\r
+       $query = "SELECT count(guid) as total from {$CONFIG->dbprefix}entities where subtype={$img_type}";\r
+       $total = get_data_row($query);\r
+       $num_albums = $total->total;\r
+\r
+       $num_comments_photos = count_annotations(0, 'object', 'image', 'generic_comment');\r
+       $num_comments_albums = count_annotations(0, 'object', 'album', 'generic_comment');\r
+       \r
+       $num_views = count_annotations(0, 'object', 'image', 'tp_view');\r
+       \r
+       if (get_plugin_setting('tagging', 'tidypics') != "disabled")\r
+               $num_tags = count_annotations(0, 'object', 'image', 'phototag');\r
+?>\r
+<p>\r
+<br />\r
+An image library is required by Tidypics to perform various manipulations: resizing on upload, watermarking, rotation, and cropping.\r
+There are three image library options with Tidypics: PHP extension <a href="http://www.php.net/manual/en/book.image.php">GD</a>, \r
+<a href="http://www.imagemagick.org/">ImageMagick</a> called via a system call, and the PHP extension \r
+<a href="http://pecl.php.net/package/imagick/">imagick</a>. GD is the most common of the three on hosted servers but suffers \r
+from serious memory usage problems when resizing photos. If you have access to ImageMagick (whether through system calls or the\r
+PHP extension), we recommend that you use that.\r
+</p><p>\r
+<h3>Testing ImageMagick Commandline</h3>\r
+To use the ImageMagick executables, PHP must be configured to allow calls to exec(). You can check our \r
+<a href="<?php echo $CONFIG->wwwroot . 'mod/tidypics/pages/server_analysis.php'; ?>">server analysis page</a> to find out the \r
+configuration of your server. Next, you need to determine the path to ImageMagick on your server. Your hosting service should \r
+be able to provide this to you. You can test if the location is correct below. If successful, it should display the version of \r
+ImageMagick installed on your server.  \r
+</p>\r
+<p>\r
+<br />\r
+<?php echo elgg_echo('tidypics:settings:im_path'); ?><br />\r
+<input name="im_location" type="text" />\r
+<input type="submit" value="Submit" onclick="TestImageMagickLocation();" />\r
+</p>\r
+<div id="im_results"></div>\r
+\r
+<script type="text/javascript">\r
+function TestImageMagickLocation()\r
+{\r
+       var loc = $('input[name=im_location]').val();\r
+       $("#im_results").html("");\r
+       $.ajax({\r
+               type: "GET",\r
+               url: "<?php echo $CONFIG->wwwroot . 'mod/tidypics/actions/imtest.php'; ?>",\r
+               data: {location: loc},\r
+               cache: false,\r
+               success: function(html){\r
+                       $("#im_results").html(html);\r
+               }\r
+       });\r
+}\r
+</script>
\ No newline at end of file
index 7d6aa220c40c4b55bb8316a7fe8ef2f0470a7754..3d31bd52e74246154f280169ef4a4a046ab54c23 100644 (file)
@@ -6,6 +6,7 @@
        
        $settingsselect = ''; 
        $statsselect = '';
+       $imagelibselect = '';
        switch($tab) {
                case 'settings':
                        $settingsselect = 'class="selected"';
@@ -13,6 +14,9 @@
                case 'stats':
                        $statsselect = 'class="selected"';
                        break;
+               case 'imagelib':
+                       $imagelibselect = 'class="selected"';
+                       break;
        }
        
 ?>
@@ -21,6 +25,7 @@
                <ul>
                        <li <?php echo $settingsselect; ?>><a href="<?php echo $CONFIG->wwwroot . 'mod/tidypics/pages/admin.php?tab=settings'; ?>"><?php echo elgg_echo('tidypics:settings'); ?></a></li>
                        <li <?php echo $statsselect; ?>><a href="<?php echo $CONFIG->wwwroot . 'mod/tidypics/pages/admin.php?tab=stats'; ?>"><?php echo elgg_echo('tidypics:stats'); ?></a></li>
+                       <li <?php echo $imagelibselect; ?>><a href="<?php echo $CONFIG->wwwroot . 'mod/tidypics/pages/admin.php?tab=imagelib'; ?>"><?php echo elgg_echo('tidypics:settings:image_lib'); ?></a></li>
                </ul>
        </div>
 <?php
@@ -31,6 +36,9 @@
                case 'stats':
                        echo elgg_view("tidypics/admin/stats");
                        break;
+               case 'imagelib':
+                       echo elgg_view("tidypics/admin/imagelib");
+                       break;
        }
 ?>
 </div>
index d493a623b292c0d83978abfeec7c08f3b68b352d..9565ddb1f408bb809847e58711a37015411c5101 100644 (file)
@@ -28,7 +28,7 @@
        // 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 = '<p>' . elgg_echo('tidypics:settings:image_lib') . ': ';\r
        $form_body .= elgg_view('input/pulldown', array(\r
                                        'internalname' => 'params[image_lib]',\r
                                        'options_values' => $img_lib_options,\r