rijavecb's avatar

rijavecb liked a comment+100 XP

1mo ago

React, The Laravel Way: Ep 19, Image Optimization

intervention/image-laravel v4 has different methods to v3 used in the video.

Ensure you have the following imports in PuppyController:

use Intervention\Image\Format;
use Intervention\Image\Laravel\Facades\Image;

You'll need to switch out Image::read() with Image::decode()

$image = Image::decode($request->file('image'));

And switch out $image->toWebp() to $image->encodeUsingFormat()

$image->encodeUsingFormat(Format::WEBP, quality: 95)