From 18a313c454d07011bb9707cf2eb806bcb4f764fb Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 17 Jun 2009 10:44:15 +0800 Subject: Use a placeholder image if ffmpeg is missing instead of throwing an exception which would get silently swallowed by swfUpload. Signed-off-by: --- modules/gallery/helpers/graphics.php | 7 ++++++- modules/gallery/helpers/movie.php | 7 ++++++- modules/gallery/images/missing_movie.png | Bin 0 -> 11653 bytes 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 modules/gallery/images/missing_movie.png (limited to 'modules') diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php index feebfb34..3f3317ae 100644 --- a/modules/gallery/helpers/graphics.php +++ b/modules/gallery/helpers/graphics.php @@ -135,7 +135,12 @@ class graphics_Core { if ($input_item->is_movie()) { // Convert the movie to a JPG first $output_file = preg_replace("/...$/", "jpg", $output_file); - movie::extract_frame($input_file, $output_file); + try { + movie::extract_frame($input_file, $output_file); + } catch (Exception $e) { + // Assuming this is MISSING_FFMPEG for now + copy(MODPATH . "gallery/images/missing_movie.png", $output_file); + } $working_file = $output_file; } else { $working_file = $input_file; diff --git a/modules/gallery/helpers/movie.php b/modules/gallery/helpers/movie.php index 1d1d29d1..28c15d81 100644 --- a/modules/gallery/helpers/movie.php +++ b/modules/gallery/helpers/movie.php @@ -53,7 +53,12 @@ class movie_Core { throw new Exception("@todo NAME_CANNOT_END_IN_PERIOD"); } - $movie_info = movie::getmoviesize($filename); + try { + $movie_info = movie::getmoviesize($filename); + } catch (Exception $e) { + // Assuming this is MISSING_FFMPEG for now + $movie_info = getimagesize(MODPATH . "gallery/images/missing_movie.png"); + } // Force an extension onto the name $pi = pathinfo($filename); diff --git a/modules/gallery/images/missing_movie.png b/modules/gallery/images/missing_movie.png new file mode 100644 index 00000000..71eb4ecf Binary files /dev/null and b/modules/gallery/images/missing_movie.png differ -- cgit v1.2.3