Do you actually have to provide the image? Couldn’t you provide a pointer to the image? Like those thumbnails that are just links on the backends but appear as images when loaded
Do you actually have to provide the image? Couldn’t you provide a pointer to the image? Like those thumbnails that are just links on the backends but appear as images when loaded
dual_sport_dork@lemmy.world 2 days ago
If you’re going to display pixels on the user’s screen, you have to send those pixels to the user. Magic still doesn’t exist. HTML img tags are indeed a “pointer,” but once the user’s browser has the path to that image file it will download the entire thing.
That said, there’s no reason to send an image that’s any bigger than it needs to be. Sending a scaled down thumbnail if you know it will be displayed small is sensible. Sending the entire 1200px wide or whatever image it is and just squashing it into a 100px wide box in the user’s browser is not.
dondelelcaro@lemmy.world 2 days ago
And use SVG when you can; bitmaps which should be vectors are frequently big and ugly.
JustAnotherKay@lemmy.world 2 days ago
I dunno why that didn’t occur to me, that makes sense
dual_sport_dork@lemmy.world 2 days ago
That’s how it works.
You may be thinking of “lazy loading,” where some scriptwork is used to delay downloading images until some time after the initial page load completes. This still requires all the data to be sent to the user — all of the data always has to be sent to the user eventually — but just not right away. This can have perceptible load time benefits, especially if whatever content you’re loading won’t be visible in the viewport initially anyway.
JustAnotherKay@lemmy.world 2 days ago
Tbh I’m just new to the computer science scene - I’ve taken one class so far on the fundamentals of programming and have only seen a real language in my free time as of yet.
It didn’t occur to me that the webpage which references another for an image would still be culpable for the space taken up by the image, because with on-disk memory management you can do tricks to reduce sizes with pointers and I just thought it would be analogous. It feels painfully obvious to me why that’s stupid now lol