mirror of
https://github.com/Intervention/image.git
synced 2025-08-21 05:01:20 +02:00
changed callback handling in cache method
This commit is contained in:
@@ -96,9 +96,13 @@ class ImageManager
|
|||||||
public function cache(Closure $callback, $lifetime = null, $returnObj = false)
|
public function cache(Closure $callback, $lifetime = null, $returnObj = false)
|
||||||
{
|
{
|
||||||
if (class_exists('\Intervention\Image\ImageCache')) {
|
if (class_exists('\Intervention\Image\ImageCache')) {
|
||||||
// Create imagecache and run callback
|
// create imagecache
|
||||||
$imagecache = new ImageCache($this);
|
$imagecache = new ImageCache($this);
|
||||||
$imagecache = is_callable($callback) ? $callback($imagecache) : $imagecache;
|
|
||||||
|
// run callback
|
||||||
|
if (is_callable($callback)) {
|
||||||
|
$callback($imagecache);
|
||||||
|
}
|
||||||
|
|
||||||
return $imagecache->get($lifetime, $returnObj);
|
return $imagecache->get($lifetime, $returnObj);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user