Dustin Anderson
2007-Jul-25 22:00 UTC
PNG Fix not working with Unique Identifiers on image paths
Hola, We''re having a problem with Internet Explorer not rendering .png files properly. We''re using a Javascript fix right now, but it''s failing when it gets to an image that has been generated by a rails image tag (e.g. the code: <%= image_tag myimage %> spits out: src="images/myimage.png?1184877097") - and that doesn''t render properly in IE. Here is my question: I''m wondering if there is a way to turn off whatever tacks on the 1184877097. (I think that''s there to prevent image caching). Have other people had this problem? What other solutions are out there? Thanks, Dustin -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Philip Hallstrom
2007-Jul-25 22:42 UTC
Re: PNG Fix not working with Unique Identifiers on image paths
> Hola, > > We''re having a problem with Internet Explorer not rendering .png files > properly. > > We''re using a Javascript fix right now, but it''s failing when it gets to > an image that has been generated by a rails image tag > > (e.g. the code: <%= image_tag myimage %> spits out: > src="images/myimage.png?1184877097") - and that doesn''t render properly > in IE. > > Here is my question: > I''m wondering if there is a way to turn off whatever tacks on the > 1184877097. > > (I think that''s there to prevent image caching). > > Have other people had this problem? What other solutions are out there?We''ve been using this in an onload handler and it has worked for us. Not sure where it came from, but PNG are transparent and we haven''t had to muck with the ?12345 part at all. function correctPNG() // correctly handle PNG transparency in Win IE 5.5 or higher. { for(var i=0; i<document.images.length; i++) { var img = document.images[i] var imgName = img.src.toUpperCase() if (imgName.match(/\.PNG/)) { if ( img.src.indexOf("google.com") != -1 ) { continue; } 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 = "<img " + imgID + imgClass + imgTitle + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" + "(src=\''" + img.src + "\'', sizingMethod=''image'');\" />" img.outerHTML = strNewHTML } } } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---