Sometimes working on a production website reminds you of problems you thought that were long gone. In this case, I needed smooth image scaling for the majority of browsers and yes, that sadly still includes MSIE6 and Firefox2.
The solution for MSIE6 is pretty well known, so I’ll keep this short: You need to apply the AlphaImageLoader with sizingMethod scale:
<img src="blank.gif" style=" filter: progid:DXImageTransform.Microsoft.AlphaImageLoader( src='myImage.jpg', sizingMethod='scale' ); " />
Firefox2 is actually more difficult here. There are no hidden properties or anything that will magically render your image smoothly. But there’s another way to do it. Namely, the SVG renderer, which uses smooth image rendering by default. So you simply need to link in an SVG via the object tag instead of the image:
<?xml?> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" > <image xlink:href="myImage.jpg" width="100%" height="100%" preserveAspectRatio="none" /> </svg>
If you want to automate the whole thing, the easiest way is using data urls, because it means that you don’t have to create separate documents. Instead you just let a script run over the page and replace the imgs with objects. The only real difference with data urls is that you have to urlencode the characters, which makes the final object tag something like this (without any linebreaks):
<object data="data:image/svg+xml,%3C?xml%20?%3E%3Csvg%20 xmlns=%22http://www.w3.org/2000/svg%22%20 xmlns:xlink=%22http://www.w3.org/1999/xlink%22%3E %3Cimage%20xlink:href=%22test.jpg%22%20 width=%22100%25%22%20height=%22100%25%22 %20preserveAspectRatio=%22none%22%20/%3E %3C/svg%3E" type="image/svg+xml" />
That’s pretty much it. Now I’m off to investigate Safari and Opera.