I’m trying to save an image with transparancies as a GIF since PNG’s don’t work in IE, but it won’t show the shadow I apply. It shows the transparancies but completely excludes the shadow. Here are two versions of the exact same image. Am i exporting the GIF with the wrong settings? Like the matte, dither, etc?
I used this a while back . . I forgot where i got the code from.
this should fix your transparent PNG problem . . . .
/*
Correctly handle PNG transparency in Win IE 5.5 & 6.
Use in <HEAD> with DEFER keyword wrapped in conditional comments:
<!--[if lt IE 7]>
<script defer type="text/javascript" src="pngfix.js"></script>
<![endif]-->
*/
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*
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
}
}
}
I guess someone spoted the link here . . .
this will take you to the source.
gp
Thank you for that, but it runs into a problem: how would I incorporate that javascript into a CSS-driven site when the JS must be called onLoad? Is there no way to fix the GIF problem? I thought they handle transpariencies like this perfectly? :hurt:
hmmm… you do realise that gifs only support one level of transparency (i.e fully transparent or fully opaque pixels)?
so a gradual shadow won’t work really in a gif file.
i’m not sure if that’s what you mean though.