summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2010-02-07 13:54:37 -0800
committerTim Almdal <tnalmdal@shaw.ca>2010-02-07 13:54:37 -0800
commit7df4d795e8c5d4b100637f0fea0ad8ef7f6aeabb (patch)
tree5fdb9d2a11f712cbff82a70e4aed19c77c5370ec /modules/gallery/helpers
parent6340d8caf2261199e029841baca66e302c861679 (diff)
parentadac97b5372322be5154996974a6496198105d16 (diff)
Merge branch 'master' of git@github.com:gallery/gallery3
Diffstat (limited to 'modules/gallery/helpers')
-rw-r--r--modules/gallery/helpers/movie.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/modules/gallery/helpers/movie.php b/modules/gallery/helpers/movie.php
index 7033b7da..3c494e96 100644
--- a/modules/gallery/helpers/movie.php
+++ b/modules/gallery/helpers/movie.php
@@ -84,6 +84,20 @@ class movie_Core {
" -an -ss 00:00:03 -an -r 1 -vframes 1" .
" -y -f mjpeg " . escapeshellarg($output_file) . " 2>&1";
exec($cmd);
+
+ clearstatcache(); // use $filename parameter when PHP_version is 5.3+
+ if (filesize($output_file) == 0) {
+ // Maybe the movie is shorter, fall back to the first frame.
+ $cmd = escapeshellcmd($ffmpeg) . " -i " . escapeshellarg($input_file) .
+ " -an -an -r 1 -vframes 1" .
+ " -y -f mjpeg " . escapeshellarg($output_file) . " 2>&1";
+ exec($cmd);
+
+ clearstatcache();
+ if (filesize($output_file) == 0) {
+ throw new Exception("@todo FFMPEG_FAILED");
+ }
+ }
}
static function find_ffmpeg() {