public function saveThumbnail(MediaInterface $media, $url)
    {
        $thumb = $this->mediaManager->createMedia();

        $thumb
            ->setStatus(Media::STATUS_HASPARENT)
            ->setName($media->getName().'_thumb')
            ->setProvider('image')
        ;

        $filename = '/tmp/'.basename($url);
        $filesystem = new Filesystem();
        $filesystem->dumpFile($filename, file_get_contents($url));
        $thumb->temp = $filename;
        $thumb->setFile(new UploadedFile($filename, basename($url)));

        $this->mediaManager->save($thumb);

        return $thumb;
    }
public function saveThumbnail(MediaInterface $media, $url)
    {
        $thumb = $this->mediaManager->createMedia();

        $thumb
            ->setStatus(Media::STATUS_HASPARENT)
            ->setName($media->getName().'_thumb')
            ->setProvider('image')
        ;

        $filename = '/tmp/'.basename($url);
        $filesystem = new Filesystem();
        $filesystem->dumpFile($filename, file_get_contents($url));
        $thumb->temp = $filename;
        $thumb->setFile(new UploadedFile($filename, basename($url)));

        $this->mediaManager->save($thumb);

        return $thumb;
    }
public function saveThumbnail ( MediaInterface $ media , $ url ) { $ thumb = $ this -> mediaManager -> createMedia ( ) ; $ thumb -> setStatus ( Media :: STATUS_HASPARENT ) -> setName ( $ media -> getName ( ) . '_thumb' ) -> setProvider ( 'image' ) ; $ filename = '/tmp/' . basename ( $ url ) ; $ filesystem = new Filesystem ( ) ; $ filesystem -> dumpFile ( $ filename , file_get_contents ( $ url ) ) ; $ thumb -> temp = $ filename ; $ thumb -> setFile ( new UploadedFile ( $ filename , basename ( $ url ) ) ) ; $ this -> mediaManager -> save ( $ thumb ) ; return $ thumb ; }
Save the thumbnail.

@param MediaInterface $media The Vimeo Object
@param string         $url

@return MediaInterface The newly created image
Save the thumbnail .