Can anyone help me how to implement resizing image in Laravel?
I have this code only:
if($request->hasFile(\'image\')){
if (Input::file(\'imag
I would recommend Intervention Image for this task.
Simply install it with composer
composer require intervention/image
and just use it like this:
\Intervention\Image\ImageManagerStatic::make('public/foo')->fit(100)->save($path);
Remarks
Service Provider
The intervention image provides a Service Provider for Laravel. You may add the service provider manually as explained here. After that, you may push the configuration file to Laravel. However, the configuration has only one option and that is the image driver. gd is default , so if you don't want to change it, there is no need to use the service provider and configuration.
Alias Instead of the service Provider, you could create an alias in config/app:
'Image' => Intervention\Image\ImageManagerStatic::class
Then you can use it like this:
\Image::make('public/foo')->fit(100)->save($path);