Loading images on the web can be a pain, especially if you are doing a website mainly for mobile devices. Because wireless connection is used in su...
For further actions, you may consider blocking this person and/or reporting abuse
I would also add that caching images for as long as possible is prudent, particularly if you're using a CDN. If an image may change in future, you can use various cache-busting techniques to replace the image even if it is cached for a long time.
would you mind explaining a few of those cache-busting techniques?
Basically, the idea is that you append a query string to the URL for an asset, usually based on the timestamp when it was last changed. That way, if you replace an image or other asset, the URL used in the application will change, and so you load the new version, no matter how long the old version was cached for.
Many frameworks and CMS's provide this functionality out of the box, such as the
version()
method in Laravel Mix. If yours doesn't it's not hard to roll your own. Here's a simple example of a Twig filter that does this:You're right! That could also be added here, thanks for pointing it out. :)
Great pieces of advices Felix :) I use them all, verlok/lazyload is astonishing! I also use gulp-reponsive to make variants of my images for each of my supported devices width (smartphone, tablet, desktop, large screen). I recommand it ;)
Nice, that makes me happy! Really looking forward to native lazy load 🙏🔥
It is still fairly new, but native lazy image loading as well.
Native Lazy Loading for <img> and <iframe> is Coming to the Web
Ben Halpern ・ Apr 7 '19
Thanks for pointing this out! That adds huge value in here, I think about update my post based on this information! Thanks! :)
I never knew the image tag has those attributes:
srcset
&sizes
. Thanks Felix!No problem, thanks for commenting! 🔥
Sure, that's what I wanted to say basically during the whole blog post! Thanks for adding it here! :)
For native software also have a look at Caesium Image Compressor. Its awesome and free.
Yeah, thanks for sharing that, will definitively try it out!! 🙏