samjoyce777 / album
Small image caching repository
Requires
- intervention/image: 2.*
- laravel/framework: 5.*
Requires (Dev)
- phpunit/phpunit: ~4.0
This package is not auto-updated.
Last update: 2024-11-09 19:40:03 UTC
README
This package simply uses a directory of your choosing, allows you to set the sizes of images and then resizes and saves them as a cache file in the public directory of your choosing. Mirrors the original folders directory structure and keeps filename but with the addition of the dimensions on the cache filename. Only makes the cache file on request so non-used images / sizes wont be cached.
Installation
$ composer install samjoyce777/album --save
Add the service provider to the config.php
$ \samjoyce777\album\AlbumServiceProvider::class,
Add the facade as well to make it all pretty
$ 'Album' => \samjoyce777\album\Facades\Album::class,
Move the config file to make your customizations
$ php artisan vendor:publish --tag=config
Usage
This will return the cache image URL of the size you have requested listed in you config
Album::getImage('cushion.jpg', 'medium');
This will get return the cache image URL of the nearest sized image from your configured sizes, it will always make sure it is the same or larger.
Album::getNearestImage('cushion.jpg', 200);