PNG alpha IE 6 problem is freaking me out...
Posted: Tue Dec 11, 2007 3:48 am
I am trying to use alpha translucent PNG images, but I can't make it to work. A script I've been using for months suddenly failed me.
As I have upgraded to IE7, I still needed IE6 for testing so I installed multipleIE. Now here's the scenario, I've used this script:
in the php page:
and in the js:
Now when I use it from my home computer it looks fine but from my work & client's computer the alpha does not work. What freaks me out most is that the PNG images sometimes work on my IE 6 at work and not from my colleague's. Even the Microsoft tests like http://samples.msdn.microsoft.com/works ... Loader.htm
So I'd come to a point to start thinking that multipleIE is buggy.
I don't know what to do, I really need to use PNG images because of the site layout, but if I am not able to test them properly, I guess I won't bother with it... and is there a way to use php in order to display PNG images properly?
As I have upgraded to IE7, I still needed IE6 for testing so I installed multipleIE. Now here's the scenario, I've used this script:
in the php page:
Code: Select all
<!--[if lt IE 7.]>
<script defer type="text/javascript" src="pngfix.js"></script>
<![endif]-->Code: Select all
var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])
if ((version >= 5.5) && (document.body.filters))
{
for(var i=0; i<document.images.length; i++)
{
var img = document.images[i]
var imgName = img.src.toUpperCase()
if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
{
var imgID = (img.id) ? "id='" + img.id + "' " : ""
var imgClass = (img.className) ? "class='" + img.className + "' " : ""
var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
var imgStyle = "display:inline-block;" + img.style.cssText
if (img.align == "left") imgStyle = "float:left;" + imgStyle
if (img.align == "right") imgStyle = "float:right;" + imgStyle
if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
var strNewHTML = "<span " + imgID + imgClass + imgTitle
+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
+ "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
img.outerHTML = strNewHTML
i = i-1
}
}
}So I'd come to a point to start thinking that multipleIE is buggy.
I don't know what to do, I really need to use PNG images because of the site layout, but if I am not able to test them properly, I guess I won't bother with it... and is there a way to use php in order to display PNG images properly?