Skip to content

DigitalCoreHub/tinypng-laravel

Repository files navigation

Tinypng Laravel Package

tinypng-laravel is a Laravel package that provides an easy and seamless way to integrate the TinyPNG API into your Laravel application. This package allows you to compress, optimize, and resize images programmatically, ensuring faster load times and reduced storage usage.

Installation

You can install the package via composer:

composer require digitalcorehub/tinypng-laravel

You can publish the config file with:

php artisan vendor:publish // select TinypngLaravelServiceProvider

This is the contents of the published config file:

return [
      'api_key' => env('TINYPNG_API_KEY'),
];

Usage

use DigitalCoreHub\TinypngLaravel\Facades\TinypngLaravel;

TinypngLaravel::compressFromUrl("https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png", $outputPath);

TinypngLaravel::compressFromFile($inputPath, $outputPath);

TinypngLaravel::compressFromBuffer("base64", $outputPath);

TinypngLaravel::resize($inputPath, $outputPath, $options);

API Reference

Please see API Reference for details.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages