1
0
mirror of https://github.com/Intervention/image.git synced 2025-01-29 17:57:50 +01:00

changed callback handling in cache method

This commit is contained in:
Oliver Vogel 2014-05-18 19:58:48 +02:00
parent 4e252a3ffa
commit e3f13700a9

View File

@ -96,9 +96,13 @@ class ImageManager
public function cache(Closure $callback, $lifetime = null, $returnObj = false)
{
if (class_exists('\Intervention\Image\ImageCache')) {
// Create imagecache and run callback
// create imagecache
$imagecache = new ImageCache($this);
$imagecache = is_callable($callback) ? $callback($imagecache) : $imagecache;
// run callback
if (is_callable($callback)) {
$callback($imagecache);
}
return $imagecache->get($lifetime, $returnObj);
}