From 5ccb3887f61af7b670f0fafe077401529c141700 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Wed, 9 Sep 2009 00:58:37 +0000 Subject: added ability to create thumbnails for images that previously failed --- actions/create_thumbnails.php | 61 +++++++++++++++++++++++++++++ actions/imtest.php | 2 +- actions/upload.php | 8 ++-- contributions.txt | 2 +- languages/en.php | 4 +- views/default/tidypics/admin/imagelib.php | 8 ++-- views/default/tidypics/admin/thumbnails.php | 33 ++++++++++++++++ views/default/tidypics/admin/tidypics.php | 8 ++++ 8 files changed, 117 insertions(+), 9 deletions(-) create mode 100644 actions/create_thumbnails.php create mode 100644 views/default/tidypics/admin/thumbnails.php diff --git a/actions/create_thumbnails.php b/actions/create_thumbnails.php new file mode 100644 index 000000000..3fefb4f0d --- /dev/null +++ b/actions/create_thumbnails.php @@ -0,0 +1,61 @@ +getFilename(); + $container_guid = $image->container_guid; + if (!$filename || !$container_guid) { + echo "Error retrieving information about the image"; + return; + } + + $title = $image->title; + $prefix = "image/" . $container_guid . "/"; + $filestorename = substr($filename, strlen($prefix)); + + $image_lib = get_plugin_setting('image_lib', 'tidypics'); + if (!$image_lib) + $image_lib = "GD"; + + if ($image_lib == 'ImageMagick') { // ImageMagick command line + + if (tp_create_imagick_cmdline_thumbnails($image, $prefix, $filestorename) != true) { + trigger_error('Tidypics warning: failed to create thumbnails - ImageMagick command line', E_USER_WARNING); + echo "Failed to create thumbnails"; + } + + } else if ($image_lib == 'ImageMagickPHP') { // ImageMagick PHP + + if (tp_create_imagick_thumbnails($image, $prefix, $filestorename) != true) { + trigger_error('Tidypics warning: failed to create thumbnails - ImageMagick PHP', E_USER_WARNING); + echo "Failed to create thumbnails"; + } + + } else { + + if (tp_create_gd_thumbnails($image, $prefix, $filestorename) != true) { + trigger_error('Tidypics warning: failed to create thumbnails - GD', E_USER_WARNING); + echo "Failed to create thumbnails"; + } + + } // end of image library selector + + echo "wwwroot}mod/tidypics/thumbnail.php?file_guid={$guid}&size=large\" alt=\"{$title}\" />"; + +?> diff --git a/actions/imtest.php b/actions/imtest.php index 6ab2b7b8f..8d5171785 100644 --- a/actions/imtest.php +++ b/actions/imtest.php @@ -1,6 +1,6 @@ guid); // update user/group size for checking quota diff --git a/contributions.txt b/contributions.txt index 0e947c122..f3427eaca 100644 --- a/contributions.txt +++ b/contributions.txt @@ -2,7 +2,7 @@ See individual change logs for contributors to those builds ------------------------------------------------------------------------ Version 1.6.2 Change List -Release Date: +Release Date: 09/03/2009 ------------------------------------------------------------------------ BEGIN VERSION 1.6.2 CHANGES ------------------------------------------------------------------------ diff --git a/languages/en.php b/languages/en.php index 83e600936..f3abfc27e 100644 --- a/languages/en.php +++ b/languages/en.php @@ -53,6 +53,7 @@ 'tidypics:settings' => 'Settings', 'tidypics:admin:instructions' => 'These are the core Tidypics settings. Change them for your setup and then click save.', 'tidypics:settings:image_lib' => "Image Library", + 'tidypics:settings:thumbnail' => "Thumbnail Creation", 'tidypics:settings:download_link' => "Show download link", 'tidypics:settings:tagging' => "Enable photo tagging", 'tidypics:settings:photo_ratings' => "Enable photo ratings (requires rate plugin of Miguel Montes or compatible)", @@ -68,7 +69,8 @@ 'tidypics:settings:largesize' => "Primary image size", 'tidypics:settings:smallsize' => "Album view image size", 'tidypics:settings:thumbsize' => "Thumbnail image size", - + 'tidypics:settings:im_id' => "Image ID", + //actions 'album:create' => "Create new album", diff --git a/views/default/tidypics/admin/imagelib.php b/views/default/tidypics/admin/imagelib.php index 8f71c75f2..deb32d0f3 100644 --- a/views/default/tidypics/admin/imagelib.php +++ b/views/default/tidypics/admin/imagelib.php @@ -18,24 +18,26 @@ if (get_plugin_setting('tagging', 'tidypics') != "disabled") $num_tags = count_annotations(0, 'object', 'image', 'phototag'); ?> -


+

Overview

+

An image library is required by Tidypics to perform various manipulations: resizing on upload, watermarking, rotation, and cropping. There are three image library options with Tidypics: PHP extension GD, ImageMagick called via a system call, and the PHP extension imagick. GD is the most common of the three on hosted servers but suffers from serious memory usage problems when resizing photos. If you have access to ImageMagick (whether through system calls or the PHP extension), we recommend that you use that. -

+

Testing ImageMagick Commandline

+

To use the ImageMagick executables, PHP must be configured to allow calls to exec(). You can check our server analysis page to find out the configuration of your server. Next, you need to determine the path to ImageMagick on your server. Your hosting service should be able to provide this to you. You can test if the location is correct below. If successful, it should display the version of ImageMagick installed on your server.

-


+


diff --git a/views/default/tidypics/admin/thumbnails.php b/views/default/tidypics/admin/thumbnails.php new file mode 100644 index 000000000..0af59090e --- /dev/null +++ b/views/default/tidypics/admin/thumbnails.php @@ -0,0 +1,33 @@ +
+

Overview

+

+This page allows you to create thumbnails for images when the thumbnail creation failed during upload. +You may experience problems with thumbnail creation if your image library in not configured properly or +if there is not enough memory for the GD library to load and resize an image. If your users have +experienced problems with thumbnail creation and you have modified your setup, you can try to redo the +thumbnails. Find the unique identifier of the photo (it is the number near the end of the url when viewing +a photo) and enter it below. +

+

Thumbnail Creation

+

+: + + +

+
+ \ No newline at end of file diff --git a/views/default/tidypics/admin/tidypics.php b/views/default/tidypics/admin/tidypics.php index 3d31bd52e..7aeb3a195 100644 --- a/views/default/tidypics/admin/tidypics.php +++ b/views/default/tidypics/admin/tidypics.php @@ -7,6 +7,7 @@ $settingsselect = ''; $statsselect = ''; $imagelibselect = ''; + $thumbnailselect = ''; switch($tab) { case 'settings': $settingsselect = 'class="selected"'; @@ -17,6 +18,9 @@ case 'imagelib': $imagelibselect = 'class="selected"'; break; + case 'thumbnail': + $thumbnailselect = 'class="selected"'; + break; } ?> @@ -26,6 +30,7 @@
  • >
  • >
  • >
  • +
  • >
  • -- cgit v1.2.3