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

First-Party Image Processing in Laravel 13.20 image

First-Party Image Processing in Laravel 13.20

Read article
Stop Failing APIs from Killing Your Queue — Fuse for Laravel image

Stop Failing APIs from Killing Your Queue — Fuse for Laravel

Read article
Cache Smart Invalidation - Laravel In Practice EP10 image

Cache Smart Invalidation - Laravel In Practice EP10

Read article
Enhancing Laravel Queries with Reusable Scope Patterns image

Enhancing Laravel Queries with Reusable Scope Patterns

Read article
Manipulate Image URLs in Laravel with the Image Transform Package image

Manipulate Image URLs in Laravel with the Image Transform Package

Read article
Stargazing in Your Laravel App with Intervention Zodiac image

Stargazing in Your Laravel App with Intervention Zodiac

Read article
Laravel Cloud logo

Laravel Cloud

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

Laravel Cloud
Harpoon: Next generation time tracking and invoicing logo

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing
LoadForge logo

LoadForge

Scalable load testing for web apps & APIs. Simulate real-world traffic and identify breaking points and performance limits with powerful, scalable load tests designed for Laravel.

LoadForge
Celebian logo

Celebian

Celebian is a social media marketing agency specializing in helping their clients go viral on TikTok. Whether you're looking to reach a bigger audience or gain more Tiktok followers, likes, and views, they've got you covered.

Celebian
The Certification of Competence for Laravel logo

The Certification of Competence for Laravel

A community-driven, proctored assessment across 4 levels designed to validate real-world Laravel knowledge, from Junior to mastery-level Artisan. Official Vue.js, Official Nuxt, Angular, React, JS certifications also available.

The Certification of Competence for Laravel
PhpStorm logo

PhpStorm

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

PhpStorm