Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fix Dynamically Generated PNG for IE6

Status
Not open for further replies.

solepixel

Programmer
May 30, 2007
111
US
Is there a way to apply a filter to a dynamically created image to fix the IE6 PNG Transparency problem? A PNG is the only way my image looks classy but in IE6, it has that gray background. Any suggestions?
 
I usually use a CSS based approach e.g.
Code:
    <!--[if lt IE 7.]>
    <style type="text/css">
    #mainlogo {background:none;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=’images/logo.png’);}
    </style>
    <![endif]-->


____________________________________________________________
Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]

Need help finding an answer? Try the Search Facility or read FAQ222-2244.
 
That's precisely what the link i posted does(go to the homepage, hover > XHTML+CSS > IE PNG Fix). It's javascript based so you don't have to apply the filter to each image individually. Very helpful when some parts of the page are dynamic. But it simply applies that filter to any PNGs, background or <IMG>.
 
That's precisely what the link i posted does
Not really. The link you posted uses a .htc file which contains javascript whereas the method I posted uses CSS conditional comments. If you are going to have lots of images on the page that need this attention (especially if you don't know how many) then the javascript method will probably be the best solution. In the case of one or two known images, I'd prefer the CSS based approach which should be faster.


____________________________________________________________
Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]

Need help finding an answer? Try the Search Facility or read FAQ222-2244.
 
Yes, very true. Any opportunity to avoid JavaScript the better. If there are only a few "known" images, this is the fastest and easiest solution.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top