コード例 #1
0
 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);
 }
コード例 #2
0
ファイル: ParamsTest.php プロジェクト: alcodo/powerimage
 /**
  * @test
  */
 public function it_get_prefix_without_params()
 {
     $path = ParamsHelper::getPrefixWithoutParams('/bla/w_200');
     $this->assertEquals('/bla', $path);
 }