@@ -196,8 +196,7 @@ class FFmpegMovie implements Serializable {
196196 * @param string $moviePath full path to the movie file
197197 * @param OutputProvider $outputProvider provides parsable output
198198 * @param string $ffmpegBinary ffmpeg executable, if $outputProvider not specified
199- * @throws Exception
200- * @return FFmpegMovie
199+ * @throws Exception
201200 */
202201 public function __construct ($ moviePath , OutputProvider $ outputProvider = null , $ ffmpegBinary = 'ffmpeg ' ) {
203202 $ this ->movieFile = $ moviePath ;
@@ -652,7 +651,8 @@ public function getFrame($framenumber = null, $height = null, $width = null, $qu
652651 */
653652 public function getFrameAtTime ($ seconds = null , $ width = null , $ height = null , $ quality = null , $ frameFilePath = null , &$ output = null ) {
654653 // Set frame position for frame extraction
655- $ frameTime = ($ seconds === null ) ? 0 : $ seconds ;
654+ $ frameTime = ($ seconds === null ) ? 0 : $ seconds ;
655+
656656
657657 // time out of range
658658 if (!is_numeric ($ frameTime ) || $ frameTime < 0 || $ frameTime > $ this ->getDuration ()) {
@@ -717,7 +717,17 @@ public function getFrameAtTime($seconds = null, $width = null, $height = null, $
717717 }
718718
719719 // Create gdimage and delete temporary image
720- $ gdImage = imagecreatefromjpeg ($ frameFilePath );
720+ switch (getimagesize ($ frameFilePath )[2 ]) {
721+ case IMAGETYPE_GIF :
722+ $ gdImage = imagecreatefromgif ($ frameFilePath );
723+ break ;
724+ case IMAGETYPE_PNG :
725+ $ gdImage = imagecreatefrompng ($ frameFilePath );
726+ break ;
727+ default :
728+ $ gdImage = imagecreatefromjpeg ($ frameFilePath );
729+ }
730+
721731 if ($ deleteTmp && is_writable ($ frameFilePath )) {
722732 unlink ($ frameFilePath );
723733 }
0 commit comments