I have a website which contains some images in index.php
The problem I am facing is the whole page is not loading at once, I think images are taking some time to load
So what I have done is, I am showing an loading image at first and then after some time I am showing the page, that resolves the problem. But I am curious to know is there any other better way to do this?
I prefer to optimise the hell out of my images.
You can use pngcrush to optimise your PNG files for you, but personally I find that once I'm done with it pngcrush only succeeds in making it bigger.
Especially for animations, there's a lot of things you can do.
combine
rather than replace
if possible. You will again have problems with transparent areas, but by using combine
you can have each subsequent frame only change the stuff that... changes. This avoids the redundancy of re-writing the entire image if only a small part changes. GIMP has a useful filter "Animation > Optimize for GIF" which will do this for you.Using the above techniques, I once managed to shove 8MB of raw image data into a 125kb animated GIF.
JPG is great for photos, but cameras have a tendency to write MASSIVE files.
The above should help you reduce the amount of size taken by your images. Obviously, you should also cache images appropriately, so they only need to be retrieved once. Also make sure that you specify width
and height
on image elements so that the browser can reserve the space for them and avoid jumping around as they load...
And you should be pretty good.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With