dev-master
9999999-devCompressing images on the fly
The Requires
by Andrey Drozd
v0.1
0.1.0.0Compressing images on the fly
The Requires
by Andrey Drozd
Wallogit.com
2017 © Pedro Peláez
Compressing images on the fly
This library provides easy way to generate image previews on the fly, (*1)
First, require the package using Composer:, (*2)
composer require androzd/imagine
Now, add these service providers to your config/app.php file (don't add the Intervention\Image\ImageServiceProvider::class if you already have it)., (*3)
Intervention\Image\ImageServiceProvider::class, Androzd\Imagine\ImagineServiceProvider::class,
And finally add these to the aliases array (note: Image must be listed before Imagine):, (*4)
'Image' => Intervention\Image\Facades\Image::class, 'Imagine' => Androzd\Imagine\ImagineFacade::class,
Feel free to use a different alias for Imagine if you'd prefer something shorter, (*5)
There are a number of configuration options available for Imagine. Run the following Artisan command to publish the configuration option to your config directory:, (*6)
php artisan vendor:publish --provider="Androzd\Imagine\ImagineServiceProvider"
// compress image by rules Imagine::path('rule_name', 'path to image in public directory');
Example:, (*7)
Imagine::path('profile_image', '/uploads/original/avatar/1.jpg');
This example makes path: /cache/profile_image/uploads/original/avatar/1.jpg, (*8)
If this image exists, it was returned by your web server as static resource., (*9)
If not exists, they will be generated and saved to /cache/profile_image/uploads/original/avatar/1.jpg and next time will be returned as static image., (*10)
Compressing images on the fly
Compressing images on the fly