Not signed in (Sign In)

Categories

Vanilla 1.1.5 is a product of Lussumo. More Information: Documentation, Community Support.

Help keep Vanilla free:
Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    • CommentAuthormis-one
    • CommentTimeSep 2nd 2006
     # 1
    Anyone have a good solution for allowing transparent PNGs to render properly in IE for Vanilla?
    • CommentAuthorJoe
    • CommentTimeSep 2nd 2006 edited
     # 2
    As far as I know it isn't possible mate. For transparency I would use gifs. Or wait for IE7?

    EDIT: Actually there might be some ways here but I wouldn't use them to be honest. Too messy.
    • CommentAuthorjeffbax
    • CommentTimeSep 2nd 2006 edited
     # 3
    You can use directx to pull it off, but its a bit of extra work unfortunately, and not something I'd really bother with personally for standards sake.
    •  
      CommentAuthorMax_B
    • CommentTimeSep 2nd 2006
     # 4
    http://homepage.ntlworld.com/bobosola/
    •  
      CommentAuthorKrak
    • CommentTimeSep 2nd 2006
     # 5
    ^ works. I use it.
  1.  # 6
    If you are in need of a solution for background images, here's a fix (link to an example on my blog), you should be able to understand what's going on if you are familiar with XHTML/CSS, and here's the related article in Serbian. (Hint: Check out the links in the article, some good documented behaviors/bugs there, in english of course.)

    Whatever the case, I'd stay away from these kind of hacks, it's just not worth it imho. Cheers.
    •  
      CommentAuthorWanderer
    • CommentTimeSep 2nd 2006
     # 7
    I don't use Windows as a rule but I have tested this with the help of friends who do.

    Save the code below to a file called pngfix.js and link to it in the HEAD section of each page...


    // Correctly handle PNG transparency in Win IE 5.5 or higher.

    function correctPNG()
    {
    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
    }
    }
    }
    window.attachEvent("onload", correctPNG);


    All my Windoze testers tell me it works.
  2.  # 8
    The best one I've seen is the PNG Behavior file: http://webfx.eae.net/dhtml/pngbehavior/pngbehavior.html

    It actually lets you specify weather the image is transparent or not in CSS:
    img {
    behavior: url("pngbehavior.htc");
    }

    All automatic, no insertion of code anywhere other than in your CSS files.
    •  
      CommentAuthorKrak
    • CommentTimeSep 2nd 2006
     # 9
    That is by far, superior. But...

    It works with the demo, on their site and my local. But when I add it to an extension I have it doesn't work.

    I added the following code to my CSS file like it said.
    <style type="text/css">

    img {
    behavior: url("pngbehavior.htc");
    }

    </style>


    Also, when viewing the demo on my local server it gives me an activex warning, asking me if i want to run it.
    •  
      CommentAuthorbugsmi0
    • CommentTimeSep 3rd 2006
     # 10
    yea but will it work in firefox ;-) I notice FF has some png issues
    •  
      CommentAuthorKrak
    • CommentTimeSep 3rd 2006
     # 11
    FF PNG issues? FF shows PNG transparencies just fine, I don't know what your talking about. All the stuff in this thread is to get them to work properly in IE.
  3.  # 12
    I'm not exactly qualified to help debug issues with it, but what do you mean by extension?
  4.  # 13
    @ Krak:
    Yes, IE will show a warning, you have to deliver the .htc files with the proper MIME type through .htaccess, like so:
    AddType text/x-component .htc
    •  
      CommentAuthorDinoboff
    • CommentTimeSep 3rd 2006 edited
     # 14
    Also, you can put pngbehavior.htc in you style folder, and add in vanilla.css:img {
    behavior: url("pngbehavior.htc");
    }

    If you add these line in the header with an extension, you have to put the path to pngbehavior.htc, url("http://domain.com/vanilla/extensions/PngExtension/pngbehavior.htc");
    •  
      CommentAuthorKrak
    • CommentTimeSep 3rd 2006
     # 15
    For the extension I used the following in "extensions\PNGFix\default.php":
    $Head->AddStyleSheet('http://domain/Vanilla/extensions/PNGFix/default.css');

    Default.css:
    img {
    behavior: url("http://domain/Vanilla/extensions/PNGFix/pngbehavior.htc");
    }


    And I placed the blank.gif in the folder as well. Just for shits-n-giggles I also tried just placing the entire pngbehavior.zip file contents in there, also doesn't work. I also tried pointing directly to the pngbehavior.zip css file, which doesn't work either. But if I view the demo in the zip, that does work. I don't get it.

    I also tried another pngfix approach. I used the code at http://homepage.ntlworld.com/bobosola/, which works in other projects (non-Vanilla related), but does not work when I try to make it an extension. For that one all I did was place the JS in an extension folder and then added
    $Head->AddString('<!--[if lt IE 7.]&gt;&lt;script defer type=&quot;text/javascript&quot; src=&quot;http://krak.servehttp.com/Vanilla/extensions/IEPNGFix/pngfix.js&quot;&gt;&lt;/script&gt;&lt;![endif]-->');


    I tried the code Wanderer posted too with the previous format. No go. Any ideas?
    •  
      CommentAuthorbugsmi0
    • CommentTimeSep 3rd 2006
     # 16
    I've always notice png color issues in FF but maybe that is only with FF on the mac which Is different than FF on windows, come to think of it I think I remember the png turning out ok with FF on windows just not on the mac
Add your comments
    Username Password
  • Format comments as