T
T
Tarasovych2017-04-26 00:15:20
Laravel
Tarasovych, 2017-04-26 00:15:20

How to implement image compression/optimization?

There are a number of images that will be used in different resolutions (eg 1000x1000 and 100x100). What is the best way to resize?
The option to resize to 1000px and then output 100px via css is probably not optimal, because it will still be 1000px loaded on the page.
Resize 2 times in different folders?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
E
entermix, 2017-04-26
@entermix

Resize 2 times in different folders?

Yes, but you can just use imagefly , like

V
Vasyl Fomin, 2017-04-26
@fomvasss

I use the InterventionImageCache plugin for such purposes
. I make the necessary routes for images that I use when displaying and simply pass the name of the image, and the plugin generates the desired size from the folder, besides, caching is used

<img class="img-responsive" src="{{ route('imagecache', ['avatar-120x120', $user->avatar]) }}">
<img class="img-responsive" src="{{ route('imagecache', ['avatar-520x520', $user->avatar]) }}">

You can also use the image-manager plugin for convenient saving of images (you can use different sizes) .

M
Mokhirjon Naimov, 2017-04-27
@zvermafia

Very handy: Laravel Medialibrary .
Determine what sizes you need (you can add filters) and it will make different versions of the photo itself...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question