aboutsummaryrefslogtreecommitdiffstats
path: root/admin/include/functions_upload.inc.php
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2010-12-22 15:15:35 +0000
committerplegall <plg@piwigo.org>2010-12-22 15:15:35 +0000
commit902c8f19278f389c53b23fcfbd0a0fe87a733372 (patch)
treec656c64325a4bd3f4b5b889c687ddc4111b6082d /admin/include/functions_upload.inc.php
parent48aa7f582191b39bc4b94fd2b2fc7a57523b95af (diff)
feature 2077 added: when ImageMagick is active, ability to remove or resize
the high definition version of the photo. git-svn-id: http://piwigo.org/svn/trunk@8227 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin/include/functions_upload.inc.php')
-rw-r--r--admin/include/functions_upload.inc.php39
1 files changed, 38 insertions, 1 deletions
diff --git a/admin/include/functions_upload.inc.php b/admin/include/functions_upload.inc.php
index d3716948a..7eaeb90f5 100644
--- a/admin/include/functions_upload.inc.php
+++ b/admin/include/functions_upload.inc.php
@@ -84,6 +84,33 @@ function add_uploaded_file($source_filepath, $original_filename=null, $categorie
$conf['upload_form_websize_quality'],
false
);
+
+ if (is_imagick())
+ {
+ if ($conf['upload_form_hd_keep'])
+ {
+ $need_resize = need_resize($high_path, $conf['upload_form_hd_maxwidth'], $conf['upload_form_hd_maxheight']);
+
+ if ($conf['upload_form_hd_resize'] and $need_resize)
+ {
+ pwg_image_resize(
+ false,
+ $high_path,
+ $high_path,
+ $conf['upload_form_hd_maxwidth'],
+ $conf['upload_form_hd_maxheight'],
+ $conf['upload_form_hd_quality'],
+ false
+ );
+ $high_infos = pwg_image_infos($high_path);
+ }
+ }
+ else
+ {
+ unlink($high_path);
+ $high_infos = null;
+ }
+ }
}
$file_infos = pwg_image_infos($file_path);
@@ -250,7 +277,7 @@ function pwg_image_resize($result, $source_filepath, $destination_filepath, $max
return $result;
}
- if (extension_loaded('imagick'))
+ if (is_imagick())
{
return pwg_image_resize_im($source_filepath, $destination_filepath, $max_width, $max_height, $quality, $strip_metadata);
}
@@ -520,4 +547,14 @@ function add_upload_error($upload_id, $error_message)
array_push($_SESSION['uploads_error'][$upload_id], $error_message);
}
+
+function is_imagick()
+{
+ if (extension_loaded('imagick'))
+ {
+ return true;
+ }
+
+ return false;
+}
?> \ No newline at end of file