summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers/photo.php
diff options
context:
space:
mode:
authorNathan Kinkade <nath@nkinka.de>2012-12-17 22:34:12 +0000
committerNathan Kinkade <nath@nkinka.de>2012-12-17 22:34:12 +0000
commit77e2e58aeff49477242f789b367def4b08836a47 (patch)
treea5e260a21f471d7aca00362ac681cc8b96bf8a16 /modules/gallery/helpers/photo.php
parentdf12e1bcf7547802a94a7b492cdb22fca9ec6e1c (diff)
parentf2a32526be0a307005052105ed09bc337e29d333 (diff)
Merge branch 'master' of git://github.com/gallery/gallery3
Diffstat (limited to 'modules/gallery/helpers/photo.php')
-rw-r--r--modules/gallery/helpers/photo.php17
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);
+ }
}
}