Search solution

Can you help me create code that is used to speed up loading 20 images in 1 page on .htaccess

Your question is not clear, can you be more specific about it?

1 Like

Can I speed up image data loading with .htaccess

No you can’t. you should consider using a CDN (content delivery network), like Cloudflare to cache your site data.


Better suggestion is to use an image minifier online to remove the extra information that is encoded with the image. Smaller file = faster download time


Hi 7Elohim,

Depending on your use case, and the frequency of the images getting updated, you might benefit from using a sprite of all images as thumbnails and displaying them using CSS background-position and background-size on different divs.

If you know that these images are used to display as small-size thumbnails, this (aggressive) method can reduce your image download to 1, or n-batches.

You may also arrange the image so that you can call images by x y locations. For example in a sprite of 10 square rows, the 54th image is on the 6th line 4th from left. Given an image of size 100x100px, you can easily get the image to display with:

<div style="background-image:url(.....);background-position:-600px -400px,background-size:100px 100px;"></div>

Using CDN on sprite images makes it a heck lot faster.

You might want to code the PHP part for generating the sprite as well using GD library.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.