mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-28 04:09:56 +03:00
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
This commit is contained in:
parent
48aa7f5821
commit
902c8f1927
6 changed files with 192 additions and 23 deletions
|
@ -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;
|
||||
}
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue