aboutsummaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
Diffstat (limited to 'actions')
-rw-r--r--actions/create_thumbnails.php61
-rw-r--r--actions/imtest.php2
-rw-r--r--actions/upload.php8
3 files changed, 67 insertions, 4 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}&amp;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