main/core/Library/Utilities/ThumbnailCreator.php
public function fromVideo($originalPath, $destinationPath, $newWidth, $newHeight)
    {
        if (!$this->isGdLoaded || !$this->isFfmpegLoaded) {
            $message = '';
            if (!$this->isGdLoaded) {
                $message .= 'The GD extension is missing \n';
            }
            if (!$this->isFfmpegLoaded) {
                $message .= 'The Ffmpeg extension is missing \n';
            }

            throw new UnloadedExtensionException($message);
        }

        $media = new \ffmpeg_movie($originalPath);
        $frameCount = $media->getFrameCount();
        $frame = $media->getFrame(round($frameCount / 2));

        if ($frame) {
            $image = $frame->toGDImage();
            $this->resize($newWidth, $newHeight, $image, $destinationPath);

            return $destinationPath;
        }

        $exception = new ExtensionNotSupportedException();
        $exception->setExtension(pathinfo($originalPath, PATHINFO_EXTENSION));
        throw $exception;
    }
public function fromVideo($originalPath, $destinationPath, $newWidth, $newHeight)
    {
        if (!$this->isGdLoaded || !$this->isFfmpegLoaded) {
            $message = '';
            if (!$this->isGdLoaded) {
                $message .= 'The GD extension is missing \n';
            }
            if (!$this->isFfmpegLoaded) {
                $message .= 'The Ffmpeg extension is missing \n';
            }

            throw new UnloadedExtensionException($message);
        }

        $media = new \ffmpeg_movie($originalPath);
        $frameCount = $media->getFrameCount();
        $frame = $media->getFrame(round($frameCount / 2));

        if ($frame) {
            $image = $frame->toGDImage();
            $this->resize($newWidth, $newHeight, $image, $destinationPath);

            return $destinationPath;
        }

        $exception = new ExtensionNotSupportedException();
        $exception->setExtension(pathinfo($originalPath, PATHINFO_EXTENSION));
        throw $exception;
    }
public function fromVideo ( $ originalPath , $ destinationPath , $ newWidth , $ newHeight ) { if ( ! $ this -> isGdLoaded || ! $ this -> isFfmpegLoaded ) { $ message = '' ; if ( ! $ this -> isGdLoaded ) { $ message .= 'The GD extension is missing \n' ; } if ( ! $ this -> isFfmpegLoaded ) { $ message .= 'The Ffmpeg extension is missing \n' ; } throw new UnloadedExtensionException ( $ message ) ; } $ media = new \ ffmpeg_movie ( $ originalPath ) ; $ frameCount = $ media -> getFrameCount ( ) ; $ frame = $ media -> getFrame ( round ( $ frameCount / 2 ) ) ; if ( $ frame ) { $ image = $ frame -> toGDImage ( ) ; $ this -> resize ( $ newWidth , $ newHeight , $ image , $ destinationPath ) ; return $ destinationPath ; } $ exception = new ExtensionNotSupportedException ( ) ; $ exception -> setExtension ( pathinfo ( $ originalPath , PATHINFO_EXTENSION ) ) ; throw $ exception ; }
Create an thumbnail from a video. Returns null if the creation failed.

@param string $originalPath    the path of the orignal video
@param string $destinationPath the path were the thumbnail will be copied
@param int    $newWidth        the width of the thumbnail
@param int    $newHeight       the width of the thumbnail

@return string
Create an thumbnail from a video . Returns null if the creation failed .