diff --git a/src/Intervention/Image/ImageCacheController.php b/src/Intervention/Image/ImageCacheController.php index 7fca05d..9680adf 100644 --- a/src/Intervention/Image/ImageCacheController.php +++ b/src/Intervention/Image/ImageCacheController.php @@ -26,7 +26,7 @@ public function getResponse($template, $filename) case 'download': return $this->getDownload($filename); - + default: return $this->getImage($template, $filename); } @@ -55,7 +55,7 @@ public function getImage($template, $filename) // build from filter template $image->make($path)->filter($template); } - + }, config('imagecache.lifetime')); return $this->buildResponse($content); @@ -106,9 +106,14 @@ private function getTemplate($template) return $template; // filter template found - case class_exists($template): + case is_string($template) && class_exists($template): return new $template; - + + // filter with arguments template found + case is_array($template): + $rc = new \ReflectionClass(array_shift($template)); + return $rc->newInstanceArgs($template); + default: // template not found abort(404); @@ -141,7 +146,7 @@ private function getImagePath($filename) /** * Builds HTTP response from given image data * - * @param string $content + * @param string $content * @return Illuminate\Http\Response */ private function buildResponse($content)