diff options
| author | Bharat Mediratta <bharat@menalto.com> | 2013-02-15 13:00:26 -0500 |
|---|---|---|
| committer | Bharat Mediratta <bharat@menalto.com> | 2013-02-15 13:00:26 -0500 |
| commit | 96a01c86d9bd15f9dc91c60be6f236deab2ffad9 (patch) | |
| tree | db06b9a5ab2b03a0475f536b9792435059f999e9 /modules/gallery/helpers/photo.php | |
| parent | 16b8b8d16b8b46fe1e60b2a86f9ee5883dbc892f (diff) | |
| parent | 5b6c138da1e53e93e4de8079885fcef29d12e673 (diff) | |
Merge branch 'master' into jquery_190
Diffstat (limited to 'modules/gallery/helpers/photo.php')
| -rw-r--r-- | modules/gallery/helpers/photo.php | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/modules/gallery/helpers/photo.php b/modules/gallery/helpers/photo.php index 51e51507..004cc7c4 100644 --- a/modules/gallery/helpers/photo.php +++ b/modules/gallery/helpers/photo.php @@ -94,10 +94,8 @@ class photo_Core { * Input is *not* standard photo type that is supported by getimagesize (e.g. tif, bmp...) * -> return metadata from getimagesize() * Input is *not* standard photo type that is *not* supported by getimagesize but is legal - * -> return zero width and height, mime type and extension according to legal_file - * Input is *not* standard photo type that is *not* supported by getimagesize and is *not* legal - * -> return zero width and height, null mime type and extension - * Input is not readable or does not exist + * -> return metadata if found by photo_get_file_metadata events + * Input is illegal, unidentifiable, unreadable, or does not exist * -> throw exception * Note: photo_get_file_metadata events can change any of the above cases (except the last one). */ @@ -133,8 +131,15 @@ class photo_Core { $metadata->height = 0; } - // Run photo_get_file_metadata events which can modify the class, then return results. + // Run photo_get_file_metadata events which can modify the class. module::event("photo_get_file_metadata", $file_path, $metadata); + + // If the post-events results are invalid, throw an exception. + if (!$metadata->width || !$metadata->height || !$metadata->mime_type || !$metadata->extension || + ($metadata->mime_type != legal_file::get_photo_types_by_extension($metadata->extension))) { + throw new Exception("@todo ILLEGAL_OR_UNINDENTIFIABLE_FILE"); + } + return array($metadata->width, $metadata->height, $metadata->mime_type, $metadata->extension); } } |
