Hi John,

wrote my first mail to fast, youre already use t:script :-).

as i wrote in th first mail the body of t:script is rendered inside hrml
script tags, and

<!--[if lt IE 7.]>
<script defer type="text/javascript" src="js/pngfix.js"></script>
<![endif]-->

is no valid javascript :-(.

try this:


<t:script onload="applyIePngFix();">

function applyIePngFix() {

  // maybe better IE recognition needed
  if (!window.all) {
    return;
  }

  var arVersion = navigator.appVersion.split("MSIE")
  var version = parseFloat(arVersion[1])

  if (version < 7.0) {
    return;
  }

  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
      }
    }
  }
}

</t:script>


I cant test, because i'm working on linux, but this should do.

you can also put the code into a file e.g. js/pngfix2.js and use it like

<t:script onload="applyIePngFix();" file="js/pngfix2.js"/>


Regards,
  Volker


John wrote:
>  http://homepage.ntlworld.com/bobosola/index.htm
> 
> I included the js file using <t:script>
> 
> <t:script>
> <!--[if lt IE 7.]>
> <script defer type="text/javascript" src="js/pngfix.js"></script>
> <![endif]-->
> </t:script>
> 
> And I see that in the page source of the rendered page
> But no - transparent pngs.
> 
> Thanks,
> John
> 
> -----Original Message-----
> From: Philippe Hennes (JIRA) [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, May 18, 2006 6:49 AM
> To: John
> Subject: [jira] Commented: (TOBAGO-69) t:image does not support a png
> image with a transparent background - displays background as mid-grey
> 
>     [
> http://issues.apache.org/jira/browse/TOBAGO-69?page=comments#action_1241
> 2344 ] 
> 
> Philippe Hennes commented on TOBAGO-69:
> ---------------------------------------
> 
> There is a bug regarding png images in IE. IE ist not capable of
> displaying 8bit png's with alpha transparency without an proprietary
> filter [1]. 
> As a workaround you can use 24bit png images or gif's.
> 
> Alternativly you can change the grey background by assigning a new
> background color:
> Photoshop: Just select the mask color option, and set the color picker
> to the color of the background the picture is intended to sit on.
> Gimp: In Gimp you can check "save background color" in the png export
> dialog.
> 
> [1]
> http://msdn.microsoft.com/workshop/author/filter/reference/filters/alpha
> imageloader.asp
> 
> 
>>t:image does not support a png image with a transparent background - 
>>displays background as mid-grey
>>----------------------------------------------------------------------
>>------------------------------
>>
>>         Key: TOBAGO-69
>>         URL: http://issues.apache.org/jira/browse/TOBAGO-69
>>     Project: MyFaces Tobago
>>        Type: Bug
> 
> 
>>    Versions: 1.0.7
>> Environment: Tomcat 5.15 - IE
>>    Reporter: John Allan
>>    Priority: Minor
> 
> 
>>Pretty much summed up in the summary.
> 
> 
> --
> This message is automatically generated by JIRA.
> -
> If you think it was sent incorrectly contact one of the administrators:
>    http://issues.apache.org/jira/secure/Administrators.jspa
> -
> For more information on JIRA, see:
>    http://www.atlassian.com/software/jira
> 
> 
> 

-- 
Don't answer to From: address!
Mail to this account are droped if not recieved via mailinglist.
To contact me direct create the mail address by
concatenating my forename to my senders domain.

Reply via email to