diff options
author | patdenice <patdenice@piwigo.org> | 2011-04-22 11:34:57 +0000 |
---|---|---|
committer | patdenice <patdenice@piwigo.org> | 2011-04-22 11:34:57 +0000 |
commit | 10ff3f2f06e5f241b14bc48474cc6fc3bc46ae0c (patch) | |
tree | e0fdd857a3a307e49177e89550aaa4161e6059c6 /admin/include | |
parent | 03c9195f7c846522c21f99f35d01d4054900f343 (diff) |
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
Diffstat (limited to 'admin/include')
-rw-r--r-- | admin/include/functions_upload.inc.php | 23 |
1 files changed, 21 insertions, 2 deletions
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) |