summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers/photo.php
diff options
context:
space:
mode:
authorshadlaws <shad@shadlaws.com>2012-12-16 18:11:01 +0100
committershadlaws <shad@shadlaws.com>2012-12-16 18:11:01 +0100
commit94b26e506c339f50b8d094057bffc1877a79afa9 (patch)
tree6926ba85de8269983e09b8ea906aceb0c241087f /modules/gallery/helpers/photo.php
parent7c62c67d56e854f69a411dd56c48ef066f951c48 (diff)
[#1924, #1925, #1927 - enhance compatibility with movies (movie helper) and file types (legal_file helper)]
bug fix: modify movie.php helper to take DAR (display aspect ratio) into account in get_file_metadata bug fix / enhancement: add duration to get_file_metadata output bug fix: modify movie.php helper to use correct resolution and duration from get_file_metadata in extract_frame bug fix: modify movie.php helper to be more robust against ffmpeg failures and limitations, including adding "-threads 1" argument if needed enhancement: modified to include ordered maps of extensions to MIME types (get_photo_types_by_extension and get_movie_types_by_extension functions), modified get_file_metadata in movie and photo helpers to use them gallery_installer, module.info, install.sql: updated to v52 with m4v mime correction code (was video/mp4)
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);
+ }
}
}