Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/approached/laravel-image-optimizer
[deprecated] Image optimizer for laravel
https://github.com/approached/laravel-image-optimizer
image-optimization laravel
Last synced: 12 days ago
JSON representation
[deprecated] Image optimizer for laravel
- Host: GitHub
- URL: https://github.com/approached/laravel-image-optimizer
- Owner: approached
- License: mit
- Created: 2015-06-25T07:51:10.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-03-05T21:49:52.000Z (over 6 years ago)
- Last Synced: 2024-09-28T15:38:06.093Z (about 1 month ago)
- Topics: image-optimization, laravel
- Language: PHP
- Homepage:
- Size: 390 KB
- Stars: 153
- Watchers: 10
- Forks: 33
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
This package is now **deprecated**. I prefer to use [spatie/image-optimizer](https://github.com/spatie/image-optimizer) package. Because this code is better structured.
# Laravel Imageoptimizer
[![License](https://poser.pugx.org/approached/laravel-image-optimizer/license)](https://packagist.org/packages/approached/laravel-image-optimizer)
[![Latest Stable Version](https://poser.pugx.org/approached/laravel-image-optimizer/v/stable)](https://packagist.org/packages/approached/laravel-image-optimizer)
[![Total Downloads](https://poser.pugx.org/approached/laravel-image-optimizer/downloads)](https://packagist.org/packages/approached/laravel-image-optimizer)
[![Build Status](https://travis-ci.org/approached/laravel-image-optimizer.svg)](https://travis-ci.org/approached/laravel-image-optimizer)With this package you can easy optimize your image in **laravel 5.x** or **lumen**. Read the google instruction https://developers.google.com/speed/docs/insights/OptimizeImages about image optimize.
## Installation
Recommend convert packages:
```bash
sudo apt-get install pngquant gifsicle jpegoptim
```- Require this package with composer:
```
composer require approached/laravel-image-optimizer
```- After updating composer, add the ServiceProvider to the providers array in `config/app.php`
```php
Approached\LaravelImageOptimizer\ServiceProvider::class,
```- Copy the package config to your local config with the publish command:
```
php artisan vendor:publish --tag=imageoptimizer
```## Usage
### Automatic ([middleware](https://laravel.com/docs/5.4/middleware))
If you want to run the ImageOptimizer automatically for all the uploaded images:
```php
Route::post('admin/image/upload', function () {
$picture = $request->file('picture');...
})->middleware('AutoImageOptimizer');
```### Manual
On uploading a file:
```php
public function store(Request $request, ImageOptimizer $imageOptimizer)
{
$picture = $request->file('picture');// optimize
$imageOptimizer->optimizeUploadedImageFile($picture);// save
Storage::put('/my/cool/path/test.jpg', File::get($picture));...
}
```## Extension
- On-demand image manipulation [alcodo/powerimage](https://github.com/alcodo/powerimage)
## License
MIT