Image::cache
Cached image processing
2.9M Downloads / Month
Open Source MIT License
2.9M Downloads / Month
Open Source MIT License
public Intervention\Image\ImageManager cache(Closure $callback, [int $lifetime, [bool $returnObj]])
Method to create a new cached image instance from a Closure callback. Pass a lifetime in minutes for the callback and decide whether you want to get an Intervention Image instance as return value or just receive the image stream.
Note: This method requires the additional package intervention/imagecache.
A closure containing the operations on an image, defining the cached image.
The lifetime in minutes of the image callback in the cache. (Default: 5
)
Decide if you want the method to return an Intervention Image instance or (by default) the image stream.
Mixed - based on returnObj
parameter.
// create a cached image and set a lifetime and return as object instead of string
$img = Image::cache(function($image) {
$image->make('public/foo.jpg')->resize(300, 200)->greyscale();
}, 10, true);