diff options
author | Silvio <silvio@devlet.com.br> | 2011-07-12 10:23:01 -0300 |
---|---|---|
committer | Silvio <silvio@devlet.com.br> | 2011-07-12 10:23:01 -0300 |
commit | d598b738b366190db350b95cebb1e1cf0e1c54c6 (patch) | |
tree | 149a39dd1cf1e9d1991ba00b61d0e990641ba519 | |
parent | 598c46cf31bd0d786cb5907ca5f23c034cce247e (diff) | |
download | video-d598b738b366190db350b95cebb1e1cf0e1c54c6.tar.gz video-d598b738b366190db350b95cebb1e1cf0e1c54c6.tar.bz2 |
Enhancing error handling at video_ffmpeg_php transcoder
-rw-r--r-- | transcoders/video_ffmpeg_php.inc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/transcoders/video_ffmpeg_php.inc b/transcoders/video_ffmpeg_php.inc index 478c333..41e0558 100644 --- a/transcoders/video_ffmpeg_php.inc +++ b/transcoders/video_ffmpeg_php.inc @@ -43,7 +43,7 @@ class video_ffmpeg_php extends video_ffmpeg implements transcoder_interface { //get the playtime from the current transcoder $duration = $this->get_playtime($videopath); - $files = NULL; + $files = array(); for ($i = 1; $i <= $total_thumbs; $i++) { $seek = ($duration / $total_thumbs) * $i - 1; //adding minus one to prevent seek times equaling the last second of the video $filename = file_munge_filename("video-thumb-" . $video['fid'] . "-$i.jpg", '', TRUE); @@ -63,12 +63,15 @@ class video_ffmpeg_php extends video_ffmpeg implements transcoder_interface { // Get the frame and create thumb file $frame = $movie->getFrame($framenumber); - $thumb = $frame->toGDImage(); - imagejpeg($thumb, drupal_realpath($thumbfile)); + + if ($frame) { + $thumb = $frame->toGDImage(); + imagejpeg($thumb, drupal_realpath($thumbfile)); + } if (!file_exists(drupal_realpath($thumbfile))) { - $error_param = array('%file' => $thumbfile, '%cmd' => $command, '%out' => $command_output); - $error_msg = t("Error generating thumbnail for video: generated file %file does not exist.<br />Command Executed:<br />%cmd<br />Command Output:<br />%out", $error_param); + $error_param = array('%file' => $thumbfile); + $error_msg = t("Error generating thumbnail for video: generated file %file does not exist.", $error_param); // Log the error message. watchdog('transcoder', $error_msg, array(), WATCHDOG_ERROR); continue; |