artwl/tinify-laravel

Tinify API support with laravel

3.0.0 2023-05-22 02:57 UTC

This package is auto-updated.

Last update: 2024-10-22 06:02:46 UTC


README

Tinify API support with laravel

Latest Version on Packagist

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');