Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Ligonsker's avatar

Caching images to load as thumbnails

Hello,

I am pretty sure this is not possible but I just want to make sure: The data team that is in charge of saving images of users to the system storage saves full size of them (The original version they were uploaded), and they weigh quite a lot, ranging between as little as 150kB to as much as 15MB (🤯).

Before I ask them to create a second compressed version of each image to be used as thumbnails I wanted to know if I can somehow use the current images and make them load faster without the need of another shrinked version?

Thanks

0 likes
4 replies
ramonrietdijk's avatar
Level 30

You may optimize the images to trim some of the size off, but when dealing with large images it won't be usable for thumbnails as the files are still way to large.

I'd recommend creating separate thumbnails for this. You can use a library like spatie/image or Intervention/image to generate them.

1 like
Ligonsker's avatar

@ramonrietdijk thanks! problem is they always update the images. I can maybe try to make a script that will check if the image exists, and if not create a thumbnail for it and then use it (Which will only take a bit time in the first load when the thumbnail does not exist), or check whether the image file was updated and do the same. (using spatie/intervention)

But maybe it will be easier for them to just do it

Please or to participate in this conversation.