diff options
author | Cash Costello <cash.costello@gmail.com> | 2009-09-09 00:58:37 +0000 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2009-09-09 00:58:37 +0000 |
commit | 5ccb3887f61af7b670f0fafe077401529c141700 (patch) | |
tree | 9c5279c63cdc38b8fd1ec7d42e444d641e8b9460 | |
parent | ce396a3cf4cce3e74b79bb4c4512066404034c47 (diff) | |
download | elgg-5ccb3887f61af7b670f0fafe077401529c141700.tar.gz elgg-5ccb3887f61af7b670f0fafe077401529c141700.tar.bz2 |
added ability to create thumbnails for images that previously failed
-rw-r--r-- | actions/create_thumbnails.php | 61 | ||||
-rw-r--r-- | actions/imtest.php | 2 | ||||
-rw-r--r-- | actions/upload.php | 8 | ||||
-rw-r--r-- | contributions.txt | 2 | ||||
-rw-r--r-- | languages/en.php | 4 | ||||
-rw-r--r-- | views/default/tidypics/admin/imagelib.php | 8 | ||||
-rw-r--r-- | views/default/tidypics/admin/thumbnails.php | 33 | ||||
-rw-r--r-- | views/default/tidypics/admin/tidypics.php | 8 |
8 files changed, 117 insertions, 9 deletions
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 @@ +<?php
+ /**
+ * Tidypics Thumbnail Creation Test
+ *
+ * Called through ajax
+ */
+
+ include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php";
+ include dirname(dirname(__FILE__)) . "/lib/resize.php";
+
+ global $CONFIG;
+
+ $guid = $_GET['guid'];
+
+ $image = get_entity($guid);
+ if (!$image || !($image instanceof TidypicsImage)) {
+ echo "Unable to get original image";
+ return;
+ }
+
+ $filename = $image->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 "<img id=\"tidypics_image\" src=\"{$CONFIG->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 @@ <?php
/**
- * Tisypics ImageMagick Location Test
+ * Tidypics ImageMagick Location Test
*
* Called through ajax
*/
diff --git a/actions/upload.php b/actions/upload.php index f330cf782..209d8e17d 100644 --- a/actions/upload.php +++ b/actions/upload.php @@ -157,7 +157,11 @@ continue;
}
-
+ //get and store the exif data
+ td_get_exif($file);
+
+
+ // resize photos to create thumbnails
if ($image_lib == 'ImageMagick') { // ImageMagick command line
if (tp_create_imagick_cmdline_thumbnails($file, $prefix, $filestorename) != true) {
@@ -183,8 +187,6 @@ $file_for_river = $file;
}
- //get and store the exif data
- td_get_exif($file);
array_push($uploaded_images, $file->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');
?>
-<p>
<br />
+<h3>Overview</h3>
+<p>
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 <a href="http://www.php.net/manual/en/book.image.php">GD</a>,
<a href="http://www.imagemagick.org/">ImageMagick</a> called via a system call, and the PHP extension
<a href="http://pecl.php.net/package/imagick/">imagick</a>. 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.
-</p><p>
+</p>
<h3>Testing ImageMagick Commandline</h3>
+<p>
To use the ImageMagick executables, PHP must be configured to allow calls to exec(). You can check our
<a href="<?php echo $CONFIG->wwwroot . 'mod/tidypics/pages/server_analysis.php'; ?>">server analysis page</a> 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.
</p>
-<p>
<br />
+<p>
<?php echo elgg_echo('tidypics:settings:im_path'); ?><br />
<input name="im_location" type="text" />
<input type="submit" value="Submit" onclick="TestImageMagickLocation();" />
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 @@ +<br />
+<h3>Overview</h3>
+<p>
+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.
+</p>
+<h3>Thumbnail Creation</h3>
+<p>
+<b><?php echo elgg_echo('tidypics:settings:im_id'); ?></b>:
+<input name="image_id" type="text" />
+<input type="submit" value="Submit" onclick="TestThumbnailCreation();" />
+</p>
+<div id="im_results"></div>
+<script type="text/javascript">
+function TestThumbnailCreation()
+{
+ var image_id = $('input[name=image_id]').val();
+ $("#im_results").html("");
+ $.ajax({
+ type: "GET",
+ url: "<?php echo $CONFIG->wwwroot . 'mod/tidypics/actions/create_thumbnails.php'; ?>",
+ data: {guid: image_id},
+ cache: false,
+ success: function(html){
+ $("#im_results").html(html);
+ }
+ });
+}
+</script>
\ 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 @@ <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> + <li <?php echo $thumbnailselect; ?>><a href="<?php echo $CONFIG->wwwroot . 'mod/tidypics/pages/admin.php?tab=thumbnail'; ?>"><?php echo elgg_echo('tidypics:settings:thumbnail'); ?></a></li> </ul> </div> <?php @@ -39,6 +44,9 @@ case 'imagelib': echo elgg_view("tidypics/admin/imagelib"); break; + case 'thumbnail': + echo elgg_view("tidypics/admin/thumbnails"); + break; } ?> </div> |