Exemplo n.º 1
0
 /**
  * Display the image
  *
  * @param ImageServiceInterface $imageService
  * @param $filename
  * @param $extension
  * @return mixed
  */
 public function show(ImageServiceInterface $imageService, $filename, $extension)
 {
     try {
         return $imageService->get($filename . '.' . $extension);
     } catch (ImageException $e) {
         throw new NotFoundHttpException();
     }
 }
Exemplo n.º 2
0
 public function get($url)
 {
     $config = env('LINK_PREVIEW_SCREENSHOT');
     if ($config) {
         $info = $this->imageService->generateFilename('jpg');
         shell_exec(str_replace(['%url', '%file'], [$url, $info['local_path']], $config));
     } else {
         throw new PreviewNotExecutableException();
     }
     $newFile = $this->imageService->generateFilename('jpg');
     $this->imageService->resize($info['local_path'], $newFile['filename'], config('preview.screenshot_width'));
     $this->imageService->delete($info['filename'], true);
     return $newFile['url'];
 }