diff options
author | Bharat Mediratta <bharat@menalto.com> | 2010-08-07 22:18:28 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2010-08-07 22:18:28 -0700 |
commit | dfb095a26267f8b68b40add03dfe407966c49b92 (patch) | |
tree | 3306c1bc1fd33fc888270b1c312771baed3b4aed /modules/gallery/helpers/photo.php | |
parent | 1abf43d3f1efa9d0d51f4c7e8f6f946db2497a09 (diff) |
Add the ability to replace the source data file in Item_Model::save().
Refactor the rotate code in Quick_Controller to replace the data file,
and then have gallery_event::item_updated_data_file() pick up after
the change is saved, rebuild the image and handle album covers. This
is much more portable than before and it will allow any mechanism (eg:
REST) to replace the source image.
Diffstat (limited to 'modules/gallery/helpers/photo.php')
-rw-r--r-- | modules/gallery/helpers/photo.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/modules/gallery/helpers/photo.php b/modules/gallery/helpers/photo.php index 73cd60c0..a38b4fb2 100644 --- a/modules/gallery/helpers/photo.php +++ b/modules/gallery/helpers/photo.php @@ -77,4 +77,16 @@ class photo_Core { } return sprintf($format, $new_width, $new_height); } + + /** + * Return the width, height, mime_type and extension of the given image file. + */ + static function get_file_metadata($file_path) { + $image_info = getimagesize($file_path); + $width = $image_info[0]; + $height = $image_info[1]; + $mime_type = $image_info["mime"]; + $extension = image_type_to_extension($image_info[2], false); + return array($width, $height, $mime_type, $extension); + } } |