From 902c8f19278f389c53b23fcfbd0a0fe87a733372 Mon Sep 17 00:00:00 2001 From: plegall Date: Wed, 22 Dec 2010 15:15:35 +0000 Subject: 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 --- admin/include/functions_upload.inc.php | 39 +++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'admin/include') 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 -- cgit v1.2.3