From 94b26e506c339f50b8d094057bffc1877a79afa9 Mon Sep 17 00:00:00 2001 From: shadlaws Date: Sun, 16 Dec 2012 18:11:01 +0100 Subject: [#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) --- modules/gallery/helpers/photo.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'modules/gallery/helpers/photo.php') 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); + } } } -- cgit v1.2.3