intervention/imagecache
最新稳定版本:2.6.0
Composer 安装命令:
composer require intervention/imagecache
包简介
Caching extension for the Intervention Image Class
README 文档
README
This package is abandoned and will no longer be maintained.
Intervention Image Cache (Abandoned)
Intervention Image Cache extends the Intervention Image Class package to be capable of image caching functionality.
The library uses the Illuminate/Cache package and can be easily integrated into the Laravel Framework. Based on your Laravel cache configuration you are able to choose between Filesystem, Database, Memcached or Redis for the temporary buffer store.
The principle is simple. Every method call to the Intervention Image class is captured and checked by the caching interface. If this particular sequence of operations already have taken place, the data will be loaded directly from the cache instead of a resource-intensive image operation.
Installation
You can install this package quickly and easily with Composer.
Require the package via Composer:
$ composer require intervention/imagecache
Now you are able to require the vendor/autoload.php file to PSR-4 autoload the library.
Laravel Integration
The Image Cache class supports Laravel integration. Best practice to use the library in Laravel is to add the ServiceProvider and Facade of the Intervention Image Class.
Open your Laravel config file config/app.php and add the following lines.
In the $providers array add the service providers for this package.
'providers' => array(
[...]
'Intervention\Image\ImageServiceProvider'
),
Add the facade of this package to the $aliases array.
'aliases' => array(
[...]
'Image' => 'Intervention\Image\Facades\Image'
),
Usage
The Image Cache is best called by the static method Image::cache from the Intervention Image class.
To create cached images just use the static method Image::cache and pass the image manipulations via closure. The method will automatically detect if a cached file for your particular operations exists.
// run the operations on the image or read a file // for the particular operations from cache $img = Image::cache(function($image) { return $image->make('public/foo.jpg')->resize(300, 200)->greyscale(); });
Determine a lifetime in minutes for the cache file as an optional second parameter. Pass a boolean true as optional third parameter to return an Intervention Image object instead of a image stream.
// determine a lifetime and return as object instead of string $img = Image::cache(function($image) { return $image->make('public/foo.jpg')->resize(300, 200)->greyscale(); }, 10, true);
Server configuration
If you have Static Resources caching enabled on Nginx please add your cache directory ({route} in config) to static resources handler exclusion:
# where "cache" is {route}
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";
}
License
Intervention Imagecache Class is licensed under the MIT License.
intervention/imagecache 适用场景与选型建议
intervention/imagecache 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8.93M 次下载、GitHub Stars 达 637, 最近一次更新时间为 2026 年 01 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「image」 「cache」 「gd」 「imagick」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 intervention/imagecache 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 intervention/imagecache 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 intervention/imagecache 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
repository php library
Yii2 LightBox image galary widget uses Lightbox v2.10.0 by Lokesh Dhakar
Stand-alone zoomify tile generator (format Zoomify) for use with OpenSeadragon, OpenLayers and various viewers.
The Yii2 extension uses jQuery jquery.carousel-1.1.min.js and makes image carousel from php array of structure defined.
Laravel 5 - Repositories to the database layer
Image manipulation library for Laravel 8 based on Imagine and inspired by Croppa for easy url based manipulation
统计信息
- 总下载量: 8.93M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 662
- 点击次数: 33
- 依赖项目数: 199
- 推荐数: 17
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-04