Exemplo n.º 1
0
 /**
  * @param $fileId
  * @param Temp $temp
  * @return \Symfony\Component\HttpFoundation\BinaryFileResponse
  */
 public function get($fileId, Temp $temp)
 {
     /** @var Temp $fileModel */
     $fileModel = $temp->findOrFail($fileId);
     try {
         $file = $fileModel->getFile();
     } catch (FileNotFoundException $exc) {
         abort(404);
     }
     return response()->download($file);
 }
Exemplo n.º 2
0
 /**
  * @param $id
  * @param Temp $tempModel
  * @return \Symfony\Component\HttpFoundation\BinaryFileResponse
  */
 public function preview($id, Temp $tempModel)
 {
     try {
         /** @var Temp $tempImage */
         $tempImage = $tempModel->findOrFail($id);
     } catch (ModelNotFoundException $exc) {
         abort(404);
     }
     $image = \Image::make($tempImage->getTempPath());
     $width = config('ignicms.images.admin_thumb_width');
     $height = config('ignicms.images.admin_thumb_height');
     $image->fit($width, $height);
     return $image->response();
 }