Adaptive Images
The landscape of web continues to change as we get more and more devices that we need to support. One concern when creating websites that should accommodate all screen sizes is image size. The acceptable size for an image is not the same across devices, so we usually end up compromising image size and quality on all devices; not the optimal solution, of course. Enter a solution called Adaptive Images, a PHP / .htaccess based solution for detecting screen size and delivering optimally sized images for the user's device.
Adaptive images provides an outstanding set of instructions for customizing the images generated by PHP's GD library, so you aren't stuck with rubbish images. Do yourself a favor and check out Adaptive Images -- it could be the perfect solution for your website imagery needs.
You've probably heard the talk around the water cooler about how promises are the future. All of the cool kids are using them, but you don't see what makes them so special. Can't you just use a callback? What's the big deal? In this article, we'll...
My team mate Edna Piranha is not only an awesome hacker; she's also a fantastic philosopher! Communication and online interactions is a subject that has kept her mind busy for a long time, and it has also resulted in a bunch of interesting experimental projects...
My sharpshooter status aside, I've always been surprised upset that Microsoft has never provided an API for the vast amount of information about users, the games they play, and statistics within the games. Namely, I'd like to publicly shame every n00b I've baptized with my...
In case you weren't aware, CSS animations are awesome. They're smooth, less taxing than JavaScript, and are the future of node animation within browsers. Dojo's mobile solution, dojox.mobile
, uses CSS animations instead of JavaScript to lighten the application's JavaScript footprint. One of my favorite effects...
This is the next BIG thing … I believe!
Will this method work with Joomla CMS sites?
It should — you’ll need to do your research about .htaccess though to make sure you don’t break Joomla.
One thing I noticed with this… it says the page loads a tiny bit of JavaScript first and creates a cookie with window size. That cookie is not going to be able to be read until the second page load. So this idea won’t work for the first time a visitor sees your site. Am I wrong?
You’re wrong ;)
If you include the script from an external file you’re right – because the time taken to fetch the external file is more than it takes to continue loading the HTML. But, if you have the code in the head (it’s only one line, and is more efficient embedded anyway), then the cookie actually gets set immediately, before the rest of the HTML has finished being loaded.
Try it – go visit http://adaptive-images.com on a large screen. If you see large images it worked, because if there isn’t a cookie set it delivers the mobile resolution, which are much smaller.
Here an alternative solution for adaptive images: http://litesite.org/holygrail/stage2/