简体   繁体   中英

how to change high resolution image to low resolution using laravel image?

I want to implement lazy load of image in my application which needs two pictures ie one for initial loading which resolution should be smaller and another one should be original picture.

I just want to know is there any function in laravel image which can change the high resolution image to low resolution image just like resizing the picture.

for Laravel there is an excellent package Intervention Image With its help it is easy to resize, and many other function

Resize example:

Image::make('images/originalimage.jpg')->resize(650, null, function ($constraint) {
   $constraint->aspectRatio(); //to preserve the aspect ratio
   $constraint->upsize();
})->save('images/smallimage.jpg');

您可以使用Intervention

Image::make(Input::file('photo'))->resize(300, 200)->save('foo.jpg');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM