summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2013-02-09 10:36:42 -0800
committerBharat Mediratta <bharat@menalto.com>2013-02-09 10:36:42 -0800
commit11e56b29da73d30ce97db190498d096e45556159 (patch)
tree0ad579274045db83bedbaa6f483ba720a2668c38
parentdce31266988a79c45ba41fca31cf95a520c7bff3 (diff)
parent8dcdb3b8e14c58a65fb98a906dc8916d481c2af4 (diff)
Merge pull request #130 from shadlaws/fix_1997
#1997 - Correct movie dimensions and mime type improperly set by contributed modules.
-rw-r--r--modules/gallery/helpers/graphics.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php
index e34af018..e66908c4 100644
--- a/modules/gallery/helpers/graphics.php
+++ b/modules/gallery/helpers/graphics.php
@@ -149,6 +149,19 @@ class graphics_Core {
if (@filesize($output_file) == 0) {
try {
movie::extract_frame($working_file, $output_file, $movie_options_wrapper->movie_options);
+ // If we're here, we know ffmpeg is installed and the movie is valid. Because the
+ // user may not always have had ffmpeg installed, the movie's width, height, and
+ // mime type may need updating. Let's use this opportunity to make sure they're
+ // correct. It's not optimal to do it at this low level, but it's not trivial to find
+ // these cases quickly in an upgrade script.
+ list ($width, $height, $mime_type) = movie::get_file_metadata($working_file);
+ // Only set them if they need updating to avoid marking them as "changed"
+ if (($item->width != $width) || ($item->height != $height) ||
+ ($item->mime_type != $mime_type)) {
+ $item->width = $width;
+ $item->height = $height;
+ $item->mime_type = $mime_type;
+ }
} catch (Exception $e) {
// Didn't work, likely because of MISSING_FFMPEG - use placeholder
graphics::_replace_image_with_placeholder($item, $target);