コード例 #1
0
ファイル: Video.php プロジェクト: robbytaylor/boom-core
 public function thumb($width = null, $height = null)
 {
     if (!$this->asset->hasThumbnail()) {
         return parent::thumb();
     }
     $thumbnail = $this->asset->getThumbnail();
     $filename = $thumbnail->getFilename();
     $im = new ImageManager();
     if ($width && $height) {
         $image = $im->cache(function ($manager) use($width, $height, $filename) {
             return $manager->make($filename)->fit($width, $height);
         });
     } else {
         $image = $im->make($filename)->encode();
     }
     return $this->response->header('content-type', $thumbnail->getMimetype())->setContent($image);
 }
コード例 #2
0
ファイル: Image.php プロジェクト: imanghafoori1/boom-core
 public function __construct(Asset $asset)
 {
     parent::__construct($asset);
     $this->manager = new ImageManager(['driver' => 'imagick']);
 }