samjoyce777 / album
小图像缓存仓库
dev-master
2016-02-07 09:25 UTC
Requires
- intervention/image: 2.*
- laravel/framework: 5.*
Requires (Dev)
- phpunit/phpunit: ~4.0
This package is not auto-updated.
Last update: 2024-09-14 18:58:38 UTC
README
此包简单地将您选择的目录用作存储,允许您设置图像大小,然后将其重新大小并保存为所选公共目录中的缓存文件。与原始文件夹的目录结构相同,但缓存文件名中增加了尺寸信息。仅在有请求时创建缓存文件,因此未使用的图像/尺寸不会被缓存。
安装
$ composer install samjoyce777/album --save
将服务提供者添加到 config.php 文件中
$ \samjoyce777\album\AlbumServiceProvider::class,
同时添加外观使其更加美观
$ 'Album' => \samjoyce777\album\Facades\Album::class,
移动配置文件以进行自定义
$ php artisan vendor:publish --tag=config
使用方法
这将返回您在配置中指定的尺寸的缓存图像URL
Album::getImage('cushion.jpg', 'medium');
这将返回从您配置的尺寸中最接近大小的缓存图像URL,它始终确保是相同的或更大的。
Album::getNearestImage('cushion.jpg', 200);