From 10ff3f2f06e5f241b14bc48474cc6fc3bc46ae0c Mon Sep 17 00:00:00 2001 From: patdenice Date: Fri, 22 Apr 2011 11:34:57 +0000 Subject: feature:2274 pwg.images.resize method is able to create or regenerate image from image path. git-svn-id: http://piwigo.org/svn/trunk@10563 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/include/functions_upload.inc.php | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'admin') diff --git a/admin/include/functions_upload.inc.php b/admin/include/functions_upload.inc.php index ce0fafeb4..022d99e46 100644 --- a/admin/include/functions_upload.inc.php +++ b/admin/include/functions_upload.inc.php @@ -556,6 +556,7 @@ function pwg_image_resize_gd($source_filepath, $destination_filepath, $max_width return false; } + $starttime = get_moment(); $gd_info = gd_info(); // extension of the picture filename @@ -645,11 +646,21 @@ function pwg_image_resize_gd($source_filepath, $destination_filepath, $max_width imagedestroy($destination_image); // everything should be OK if we are here! - return true; + 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', + ); } function pwg_image_resize_im($source_filepath, $destination_filepath, $max_width, $max_height, $quality, $strip_metadata=false, $crop=false, $follow_orientation=true) { + $starttime = get_moment(); + // extension of the picture filename $extension = strtolower(get_extension($source_filepath)); if (!in_array($extension, array('jpg', 'jpeg', 'png'))) @@ -705,7 +716,15 @@ function pwg_image_resize_im($source_filepath, $destination_filepath, $max_width $image->destroy(); // everything should be OK if we are here! - return true; + 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', + ); } function get_rotation_angle($source_filepath) -- cgit v1.2.3