Package

Intervention Imagecache

Caching extension for the Intervention Image Class

Package

intervention/imagecache

View on GitHub →

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.

Intervention Imagecache Related Articles

Intervention Validation image

Intervention Validation

Read article
Intervention Image image

Intervention Image

Read article
Stargazing in Your Laravel App with Intervention Zodiac image

Stargazing in Your Laravel App with Intervention Zodiac

Read article
Intervention Image v2 is released image

Intervention Image v2 is released

Read article
A Practical Guide to Laravel's First-Party Image Processing image

A Practical Guide to Laravel's First-Party Image Processing

Read article
First-Party Image Processing in Laravel 13.20 image

First-Party Image Processing in Laravel 13.20

Read article

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

NativePHP

The fastest way to build fully native apps for any platform (with AI or not)

NativePHP

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm

Let your users buy domains without leaving your app

If your Laravel app gives users a site, a storefront, or a workspace, they’ll eventually want their own domain. The name.com API lets them search, register, and connect one without leaving your product. It’s a clean REST API, so Laravel’s HTTP client is all you need.

Let your users buy domains without leaving your app

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum