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 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 actions/create_thumbnails.php (limited to 'actions/create_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}\" />"; + +?> -- cgit v1.2.3