Imagecache

intervention/imagecache image

Imagecache stats

Downloads
5.9M
Stars
633
Open Issues
48
Forks
96

View on GitHub →

Caching extension for the Intervention Image Class

Intervention Image Cache Summary

Intervention Image Cache is an extension for the popular Intervention Image Class package, designed to add powerful image caching capabilities. Utilizing the Illuminate/Cache package, it integrates seamlessly with the Laravel framework, allowing developers to efficiently handle image manipulations by caching results. This reduces the need for repetitive processing and improves performance by storing image operations in various cache stores such as Filesystem, Database, Memcached, or Redis.

Main Features

  • Simple Integration: Easily integrates with Laravel and other systems using PSR-4 autoloading.
  • Flexible Caching: Compatible with multiple caching backends including Filesystem, Database, Memcached, and Redis.
  • Efficient Performance: Checks if an image operation sequence is already cached, skipping resource-intensive processing.
  • Dynamic Usage: Allows dynamic image manipulation while leveraging caching to avoid redundant processing.

Installation and Configuration

Install the package using Composer:

$ composer require intervention/imagecache

For Laravel integration, update config/app.php:

'providers' => [
...
'Intervention\Image\ImageServiceProvider'
],
 
'aliases' => [
...
'Image' => 'Intervention\Image\Facades\Image'
],

Usage

Invoke the Image::cache method to perform and cache image operations:

$img = Image::cache(function($image) {
return $image->make('public/foo.jpg')->resize(300, 200)->greyscale();
}, 10, true); // 10 minutes cache, return as object

Server Configuration

For Nginx servers using static resource caching, exclude the image cache directory to prevent caching issues:

location ~* ^\/(?!cache).*\.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc|webp|woff|woff2)$ {
expires max;
access_log off;
add_header Cache-Control "public";
}

Intervention Image Cache enhances image handling in applications by reducing load times and server demand through effective caching strategies, making it an essential tool for developers working with image-heavy Laravel applications.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.


Intervention Imagecache Related Articles

Blastup logo

Blastup

Blastup provides social media enhancement services including buying Instagram likes, followers, and views, with features like instant delivery and a variety of packages to suit different needs.

Blastup
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Securing Laravel logo

Securing Laravel

The essential security resource for Laravel devs, covering everything you need to keep your apps secure. Sign up to receive weekly security tips and monthly in depth articles, diving deep into security concepts you need to know!

Securing Laravel
Laravel Cloud logo

Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Cloud
Honeybadger logo

Honeybadger

Simple developer-focused application monitoring for Laravel. Error tracking, log management, uptime monitoring, status pages, and more!

Honeybadger
Acquaint Softtech logo

Acquaint Softtech

Acquaint Softtech offers AI-ready Laravel developers who onboard in 48 hours at $3000/Month with no lengthy sales process and a 100 percent money-back guarantee.

Acquaint Softtech