php - How to add TinyPNG to Ckeditor & Elfinder? -


i have laravel 5 project.

i use ckeditor , elfinder upload images in posts.

normally , use tinypng php api optimize other images. can't integrate tinypng api ckeditor&elfinder .

is there way ?

i recommend install laravel-image-optimizer spatie, sets middleware detects when request contains image , passes correct image optimizers have installed in system automatically.

to install run:

composer require spatie/laravel-image-optimizer 

and add config file app.php:

// config/app.php 'providers' => [     ...     spatie\laravelimageoptimizer\imageoptimizerserviceprovider::class, ]; 

and:

// config/app.php 'aliases' => [     ...     'imageoptimizer' => spatie\laravelimageoptimizer\imageoptimizerfacade::class, ]; 

to use wrap upload endpoint middleware:

route::middleware('optimizeimages')->group(function () {     // images optimized automatically     route::post('upload-images', 'uploadcontroller@index); }); 

as mentioned in documentation supported optimizers by default are:

the package use these optimizers if present on system:

  • jpegoptim
  • optipng
  • pngquant 2
  • svgo
  • gifsicle

if want, means, use optimizer, package has covered, follow this section of documentation.

hope helps you.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -