Adaptive Images in HTML
adaptive-images.com
adaptive-images.com
But this is exactly the kind of thing that PHP is good at. Dump a file in a directory that does one specific thing, and you're good to go. No need to integrate it with the rest of your web site. It's just a little CGI-like script that does its own thing.
But if you use this on a smallish VPS, keep an eye on memory usage. Image processing in PHP tends to hog a lot of RAM, and even a small number of simultaneous requests can crash a server. You might need to warm your cache a little bit before going public with new images.
if ($request_filename !~* ai-cache) {
rewrite \.(?:jpe?g|gif|png)$ /adaptive-images.php last;
}What we need is the ability to tell the client what we have, then let the client choose the right one based on screen size and bandwidth. Browsers should be able to do that for us. Here's one solution along that line:
http://www.alistapart.com/articles/responsive-images-how-the...
As an aside I despise any separation that even brings up the word mobile. My smartphone has a higher resolution than many desktops...coupled with a higher network performance than many high speed connections. The days of treating these mobile computers as gimpy halfwits is long past.
Regarding mobile, I'm not sure the separation is about performance as much as it is about being nice to users with capped data plans. And even with a high resolution mobile display, you just don't need the same size images for a 3 inch phone as you do for a 24 inch desktop monitor. In fact, I think one of the intentions of the responsive design movement is to serve identical experiences to desktops and mobiles, while adjusting the format somewhat to make the latter easier on the eyes. This is a huge improvement over serving one of those dumbed-down, text only mobile sites that blogs and such are so fond of redirecting you to (I'm looking at you, wordpress).
This solution works fine if JavaScript is disabled. It just loads the smallest image if "mobile" is in the user agent string and the largest image otherwise.
http://www.slideshare.net/yiibu/adaptation-why-responsive-de...
http://24ways.org/2011/adaptive-images-for-responsive-design...