Commentary and insight on web development and the Internet at large written with a wry smile and a hungry look.
image quality versus page load speed - Thu Aug 06, 2009
So what is the answer to following question?
100 - 25 = ???
Well, if we are talking JPG quality levels and PHP's GD based image resizing functions then the answer is an approximate 10 times reduction in file size!
A customer was recently commenting on slow page loading for site of theirs. Taking a closer look I noticed that the image resize class being used was defaulting to 100 for the quality argument for PHP's imagejpeg() function. Adjusting this down to 75 plus adding in a bit more on the fly thumbnail creation for larger images took their index page from a startling 7MB down to around 600KB (still high but this is an image heavy site)
These things are easy to miss when you are developing on a local desktop or LAN hosted server. A quick peek at the "View Page Information" menu provided by the excellent Firefox Web Developer plugin is a great way to check whether you are going well over your bandwidth budget for your current project.
topics: bandwidth, browser plugins, images, PHP, programming, user experience
Experienced PHP web developer.
$35 an hour, no job too small.
There is no replacement for integrity and experience.