3 ms·
To resize images, i create a cookie with javascript that gives the browsers current width and height. (mostly for full image front pages -> the function for cho
by NicoJuicy 12y ago
To resize images, i create a cookie with javascript that gives the browsers current width and height. (mostly for full image front pages -> the function for choosing the image width is based on bootstrap)
When i read the title, i thought media-queries would get the functionality to load external stylesheets, which seems like a better option to me (especially if css could fill the img src, then stylesheets reduce in size, but also images. Only this option uses to much back-and-fort communication. Perhaps a default naming would be appropriate (eg. img-1024.jpg => for browsers with a max-width of 1024 px, same could be used with stylesheets). Even a syntax like <img src="small.jpg" srcset="large.jpg 1024w, medium.jpg 640w"> could be used.
PS. If you downvote me, at least do it with the decency of giving arguments...
- idlewords 12y agoIt's also horrible for anyone trying to archive your page.
- NicoJuicy 12y agoThen the archiving functionality saves all additional stylesheets and images, so it can be appropriately used later on. But not much people "save" a page as html, they bookmark/favorite it, if it's interesting or print it to pdf (or your favorite document type)- eg. on a checkout Then again, what's your preference?
- acdha 12y ago0. This requires a full server round trip before it can send the right size images. 1. This breaks caching, which is a big deal for most sites. 2. This also has the problem of needing a separate fallback to handle window resizing. 3. This requires a separate approach to handle format detection, although you could set a cookie for that as well.