diff options
| author | Bharat Mediratta <bharat@menalto.com> | 2012-12-17 08:10:02 -0800 |
|---|---|---|
| committer | Bharat Mediratta <bharat@menalto.com> | 2012-12-17 08:10:02 -0800 |
| commit | 98753bc6aa6baee2b90af31acabb27f206ebe527 (patch) | |
| tree | 9cdc6c9e7eb8f79d23bf312802b026bbec3f8b2b /modules/gallery/helpers/photo.php | |
| parent | 989c24eea3bf01ec621ff3e6ad8a3d58debe0513 (diff) | |
| parent | 768e6fae09c941443e1004e1dfcc42ead9ad9498 (diff) | |
Merge pull request #80 from shadlaws/master
[#1924, #1925, #1927 - enhance compatibility with movies (movie helper) and file types (legal_file helper)]
Diffstat (limited to 'modules/gallery/helpers/photo.php')
| -rw-r--r-- | modules/gallery/helpers/photo.php | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/modules/gallery/helpers/photo.php b/modules/gallery/helpers/photo.php index 9f2951d5..c4001bd5 100644 --- a/modules/gallery/helpers/photo.php +++ b/modules/gallery/helpers/photo.php @@ -83,10 +83,17 @@ class photo_Core { */ 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); + if ($image_info) { + $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); + } else { + // getimagesize failed - use legal_file mapping instead. + $extension = strtolower(pathinfo($file_path, PATHINFO_EXTENSION)); + $mime_type = legal_file::get_photo_types_by_extension($extension); + return array(0, 0, $mime_type, $extension); + } } } |
