Hire Laravel developers with AI expertise at $20/hr. Get started in 48 hours.

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

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
Intervention Image image

Intervention Image

Read article
Get expert guidance in a few days with a Laravel code review logo

Get expert guidance in a few days with a Laravel code review

Expert code review! Get clear, practical feedback from two Laravel devs with 10+ years of experience helping teams build better apps.

Get expert guidance in a few days with a Laravel code review
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
CodeKudu logo

CodeKudu

Stand-ups, Retrospectives, and 360° Feedback for the entire team. 50% off with code LARAVELNEWS.

CodeKudu
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
DreamzTech logo

DreamzTech

Hire 6-10+ Yrs. experienced skilled Laravel Developers from DreamzTech. We ensure NDA protected, 100% quality delivery. Contact Us & Discuss Your Need.

DreamzTech