Managing images on an image-intensive website

I am replacing an old website and making a new one which is responsive, mobile-first. It is an online newspaper, and as such, will have a lot of images. It sounds like you have to be really mindful of webpage sizes and bandwidth to give a good user experience. So I am looking for advice of how to AVOID having images choke my website and thus frustrate end-users...
39 Replies
b1mind
b1mindā€¢6d ago
Start with https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/srcset You can serve different sized and supported images this way for different devices screen sizes Then tap into https://developer.mozilla.org/en-US/docs/Web/Performance/Lazy_loading Which you can have on any <img> below the fold (viewport landing) that will load when you get closer to them in the view pane.
McMarty
McMartyOPā€¢6d ago
Does that BLOCK other sizes from loading? So "lazy loading" is Javascript?
b1mind
b1mindā€¢6d ago
no Read before you reply please both those questions would be answered if you bothered to open the links and read šŸ˜¦ o wait thats mb I linked wrong lazy load oh no its there scroll down a bit šŸ™‚
b1mind
b1mindā€¢6d ago
These are Web API's built into the browser
McMarty
McMartyOPā€¢6d ago
Can I paste screenshots here?
b1mind
b1mindā€¢6d ago
yes? Just no pdf* uploads šŸ™‚ just paste is fine ofc
McMarty
McMartyOPā€¢6d ago
No description
McMarty
McMartyOPā€¢6d ago
You would like to think MDN would program webpages that work.....
b1mind
b1mindā€¢6d ago
it works just not for you apparently xD
McMarty
McMartyOPā€¢6d ago
Not in Firefox
b1mind
b1mindā€¢6d ago
The new IE ofc try it in chromium then
McMarty
McMartyOPā€¢6d ago
Does adblocker break things?
b1mind
b1mindā€¢6d ago
worth a try šŸ¤·ā€ā™‚ļø You are a developer though you should make sure you have both installed I have Edge/Chrome/FF and if I could I would have Safari but they are aholes wont release Safari for windows >.>;; (I'm sure it would be complicated but w/e)
McMarty
McMartyOPā€¢6d ago
I have Chrome on my laptop, but Google is evil
b1mind
b1mindā€¢6d ago
So I use Playwright and Webkit to test Safari
McMarty
McMartyOPā€¢6d ago
No description
b1mind
b1mindā€¢6d ago
Yea dood FF just sux sorry not sorry #newIEisFF Try Brave or something then
McMarty
McMartyOPā€¢6d ago
That is after clicking on </> Play in the first screenshot and also allows ads That's news to me. You saying FF sucks?
b1mind
b1mindā€¢6d ago
Yes its the new Internet Explorer >.>;; and Mozilla is not peach of a company either anymore If you really wanna get into my opinion on it use Edge (but then yes MS is Evil...) So use what you want just know that FF might have issues its behind and draggin support at the cost of 2% of all browser users (hence the new IE comments) Others here don't agree with me and love FF
McMarty
McMartyOPā€¢6d ago
And this happened when? And why?
b1mind
b1mindā€¢6d ago
4 years ago? When they laid off their whole FF dev team
McMarty
McMartyOPā€¢6d ago
What d you mean?
b1mind
b1mindā€¢6d ago
and gave their CEO a big fat millions of $$$ bonus in the same breath
McMarty
McMartyOPā€¢6d ago
Wow, news to me. Interesting
b1mind
b1mindā€¢6d ago
now you konw Jen Simmons lucky for us is over at Safari now with others and making it better so not a total loss
McMarty
McMartyOPā€¢6d ago
Who is Jen Simmons?
b1mind
b1mindā€¢6d ago
So ya when ever she got laid of from FF is when it started.. look her up šŸ™‚ Any way this went way WAY off topic You can search for other resources to find what you need if MDN does not work for you <srcset> and <img loading="lazy">
McMarty
McMartyOPā€¢6d ago
I was just trying to get that link to work because you want me to read it
b1mind
b1mindā€¢6d ago
You didn't need the code block to read it So idk what the issue is
McMarty
McMartyOPā€¢6d ago
Was that a video? Or some interactive code?
b1mind
b1mindā€¢6d ago
interactive example?
McMarty
McMartyOPā€¢6d ago
Then I'll just read what I can
b1mind
b1mindā€¢6d ago
you can always searx for another resource too big part of being a developer is being able to lookup stuff once someone as pointed you on the path with good keywords or methods plenty of articles out there on both these things or videos ( I prefer to watch/listen)
McMarty
McMartyOPā€¢6d ago
ok Why did they use Javascript? Isn't that solution just purely HTML?
b1mind
b1mindā€¢6d ago
Chris Coyier
CSS-Tricks
HTML Responsive Images Guide | CSS-Tricks
This guide is about the HTML syntax for responsive images (and a little bit of CSS for good measure). We'll go over srcset and , plus a whole bunch of things to consider to help you get the best performance and design control from your images.
McMarty
McMartyOPā€¢6d ago
Is this really just a matter of planning out image sizes and some simple HTML, CSS and maybe JS and that's it? (I thought this would be really hard and require enterprise solutuons..)
b1mind
b1mindā€¢6d ago
You don't need enterprise solutions for most things.. xD also modern web is powerful. HTML is becoming even more powerful too along with CSS
Jochem
Jochemā€¢6d ago
Enterprise solutions are for two things: collaborating as huge teams, and serving tens or hundreds of thousands of concurrent users. Neither are a worry if you are working solo
Want results from more Discord servers?
Add your server