diff options
author | patdenice <patdenice@piwigo.org> | 2011-04-22 13:19:36 +0000 |
---|---|---|
committer | patdenice <patdenice@piwigo.org> | 2011-04-22 13:19:36 +0000 |
commit | a3963aedefad0eaefe0ba9aed463de35ee144d24 (patch) | |
tree | 7fc11b4a2be8348bc6fcf6458c7ee378741e55a8 /admin/include/functions_upload.inc.php | |
parent | 041fc62aa12cbde0c073cbc4167137d84ea71706 (diff) |
feature:2274
Create thumbnail through ajax.
Remove $conf['tn_width'], $conf['tn_height'] and $conf['tn_compression_level'] parameters.
git-svn-id: http://piwigo.org/svn/trunk@10570 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | admin/include/functions_upload.inc.php | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/admin/include/functions_upload.inc.php b/admin/include/functions_upload.inc.php index 022d99e46..aa25e5219 100644 --- a/admin/include/functions_upload.inc.php +++ b/admin/include/functions_upload.inc.php @@ -604,7 +604,7 @@ function pwg_image_resize_gd($source_filepath, $destination_filepath, $max_width { // the image doesn't need any resize! We just copy it to the destination copy($source_filepath, $destination_filepath); - return true; + return get_resize_result($source_filepath, $destination_filepath, $resize_dimensions['width'], $resize_dimensions['height'], $starttime, 'GD'); } $destination_image = imagecreatetruecolor($resize_dimensions['width'], $resize_dimensions['height']); @@ -646,15 +646,7 @@ function pwg_image_resize_gd($source_filepath, $destination_filepath, $max_width imagedestroy($destination_image); // everything should be OK if we are here! - return array( - 'source' => $source_filepath, - 'destination' => $destination_filepath, - 'width' => $resize_dimensions['width'], - 'height' => $resize_dimensions['height'], - 'size' => floor(filesize($destination_filepath) / 1024).' KB', - 'time' => number_format((get_moment() - $starttime) * 1000, 2, '.', ' ').' ms', - 'library' => 'GD', - ); + return get_resize_result($source_filepath, $destination_filepath, $resize_dimensions['width'], $resize_dimensions['height'], $starttime, 'GD'); } function pwg_image_resize_im($source_filepath, $destination_filepath, $max_width, $max_height, $quality, $strip_metadata=false, $crop=false, $follow_orientation=true) @@ -691,7 +683,7 @@ function pwg_image_resize_im($source_filepath, $destination_filepath, $max_width { // the image doesn't need any resize! We just copy it to the destination copy($source_filepath, $destination_filepath); - return true; + get_resize_result($source_filepath, $destination_filepath, $resize_dimensions['width'], $resize_dimensions['height'], $starttime, 'ImageMagick'); } $image->setImageCompressionQuality($quality); @@ -716,15 +708,7 @@ function pwg_image_resize_im($source_filepath, $destination_filepath, $max_width $image->destroy(); // everything should be OK if we are here! - return array( - 'source' => $source_filepath, - 'destination' => $destination_filepath, - 'width' => $resize_dimensions['width'], - 'height' => $resize_dimensions['height'], - 'size' => floor(filesize($destination_filepath) / 1024).' KB', - 'time' => number_format((get_moment() - $starttime) * 1000, 2, '.', ' ').' ms', - 'library' => 'ImageMagick', - ); + return get_resize_result($source_filepath, $destination_filepath, $resize_dimensions['width'], $resize_dimensions['height'], $starttime, 'ImageMagick'); } function get_rotation_angle($source_filepath) @@ -966,4 +950,17 @@ function file_path_for_type($file_path, $type='thumb') return $file_path; } + +function get_resize_result($source_filepath, $destination_filepath, $width, $height, $time, $library) +{ + return array( + 'source' => $source_filepath, + 'destination' => $destination_filepath, + 'width' => $width, + 'height' => $height, + 'size' => floor(filesize($destination_filepath) / 1024).' KB', + 'time' => number_format((get_moment() - $time) * 1000, 2, '.', ' ').' ms', + 'library' => $library, + ); +} ?>
\ No newline at end of file |