public function show($prefix, $file)
 {
     $absoluteFilename = $prefix . '/' . $file;
     // orignal or resized image already available
     if (Storage::disk('powerimage')->exists($absoluteFilename)) {
         return $this->showImageFile($absoluteFilename);
     }
     $params = ParamsHelper::getParamsFromPrefix($prefix);
     // original image not available
     if (empty($params)) {
         abort(404);
     }
     // resize image
     $prefixWithoutParams = ParamsHelper::getPrefixWithoutParams($prefix);
     $rs = new ResizeImage($prefixWithoutParams, $params);
     $resizedFilepath = $this->dispatch($rs);
     // output resized image
     return $this->showImageFile($resizedFilepath);
 }
Beispiel #2
0
 /**
  * @test
  */
 public function it_get_prefix_without_params()
 {
     $path = ParamsHelper::getPrefixWithoutParams('/bla/w_200');
     $this->assertEquals('/bla', $path);
 }