artwl / tinify-laravel
Tinify API support with laravel
3.0.0
2023-05-22 02:57 UTC
Requires
- php: >=5.5.0
- illuminate/support: *
- tinify/tinify: *
README
Tinify API support with laravel
Install
$ composer require artwl/tinify-laravel
Config
Add this to your config/app.php
under "providers":
Artwl\LaravelTinify\LaravelTinifyServiceProvider::class,
under "aliases":
'Tinify' => Artwl\LaravelTinify\Facades\Tinify::class
Set Tinypng APIKEY
Set a env variable TINIFY_APIKEY
in .env
file with your tinypng api key.
Examples
Compressing
use Tinify; $result = Tinify::fromFile('\path\to\file'); $result -> toFile('\path\to\save');
Resizing And Compressing
use Tinify; $result = Tinify::fromFile('\path\to\file'); $result -> resize(array( "method" => "fit", "width" => 150, "height" => 100 )); $result -> toFile('\path\to\save');