• 9th May 2008 - By Taha Paksu

    This plugin uses CSS technique to fix the png image transparency issue and jQuery to apply this script to all of png images shown in the page. The CSS code added by the script is :

    1
    2
    3
    4
    5
    6
    7
    8
    9
    .png {
    background-image: expression(
    this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=" + (this.tagName==\'IMG\' ? this[\'src\'] : this.currentStyle[\'backgroundImage\'].split(\'\"\')[1]) + ")",
    this.runtimeStyle.backgroundImage = "none",
    this.src = "{plugindir}/pixel.gif",
    this.width = this.style.width | this.clientWidth,
    this.height = this.style.height | this.clientHeight
    );
    }'
    ;

     

    And the jQuery code which applies this css to all of the png images :

    1
    2
    3
    4
    5
    $(document).ready(function(){
    if(($.browser.msie)&(parseInt($.browser.version)<7)){
    $("img[src$='.png']").each(function(){$(this).addClass("png");});
    }
    });

     

    That’s all. The jQuery library is included in the plugin so you don’t need to modify anything.

    Installation is simple. Just follow these steps :

    1. Upload ‘wp-pngfix’ directory to the ‘/wp-content/plugins/’ directory
    2. Activate the plugin through the ‘Plugins’ menu in WordPress
    3. Thats all. Go to any page which contains some png images with IE and check if there’s any errors.

    This should fix them all except backgrounds now.

    Download: Official WordPress plugin page : http://wordpress.org/extend/plugins/wp-pngfix/

    Note: This type of fixes cause slight color changes to your png images with background color, so you may have to change some css.If you use images without inner backgrounds and only need to show the background transparent, forget that note :)



    Yazıyı Paylaş:
    • Digg
    • del.icio.us
    • Facebook
    • Google Bookmarks
    • Live
    • Slashdot
    • StumbleUpon
    • Technorati
    • Furl
    • NewsVine
    • Pownce
    • Reddit
    • SphereIt
    • Spurl
    • TwitThis

  • 47 Responses to “pngfix Wordpress Plugin”

    • [...] from here 15) WP pngfix- This plugin uses CSS technique to fix the png image transparency issue and jQuery to apply this [...]

    • [...] from here 15) WP pngfix- This plugin uses CSS technique to fix the png image transparency issue and jQuery to apply this [...]

    • Gary Crossey on 20 September 2009

      GOT MY SITE TO VALIDATE WITHOUT ANY VALIDATION WARNING – with PNGFIX

      In the pngfix.php

      Revise the & and < (less-than) sign with the code below.

      if(($.browser.msie)"&"(parseInt($.browser.version)<7)){

      Hope that helps.

      ReplyReply
      • Taha Paksu on 21 September 2009

        Is the plugin still working after you did that?

        ReplyReply
    • Gary Crossey on 20 September 2009

      I use the PNGFIX to fix PNG transparency images that I have posted on my gallery page: http://irishguy.info/graphic-design/ – the plug-in works great.

      However, when trying to validate my website I got two warnings.

      if(($.browser.msie)&(parseInt($.browser.version)<7)){

      The first error is for the "&" and the second is for using the "<"

      To solve the first error I changed the & to "&"

      Still trying to figure out how to validate without a warning for the "<" (less than sign) being included.

      Any suggestions. Thanks for the plug-n

      ReplyReply
    • shane plasebo on 12 April 2009

      Is it compatible with wordpress 2.7.1 ? Please help…

      ReplyReply
    • Brendan on 27 March 2009

      heres the link

      ReplyReply
    • Brendan on 27 March 2009

      I installed your code for a png hack and at the top of the page on IE 6 I there is excessivel code ” ‘; ?>” (without the quotes)

      On the most recent safari I see ‘; ?>

      I have been trying to get these hacks out for a while and have had no luck. Any help would be appreciated

      ReplyReply
    • N on 10 February 2009

      Another solution that I found to work, is to add “jQuery.noConflict();” at the beginning of the pngfix.php’s javascript code (right before “jQuery(function($){“).

      ReplyReply
    • Voya on 13 January 2009

      Hey kardasi! This might be useful, i will test it out later! :D

      Just a note – use javascript without noscript to handle this : If you wish to donate, you can click one of the google ads – it’s against google policy, if they find out that, they will ban you.

      try this instead ( since google can’t read JS, or use an image! )

      document.write ( “If you wish to donate, you can click one of the google ads “);

      cheers :)

      ReplyReply
      • Taha Paksu on 25 January 2009

        Voya : Thank you :) I’ll try that

        ReplyReply
    • [...] 4. PNG-24 FIX [...]

    • MuSnake on 7 November 2008

      getting closer…

      change source attribute of line 31 of pngfix.php to:

      [code] '. ABSPATH . WPINC . '/js/jquery.js[/code]

      ReplyReply
    • MuSnake on 7 November 2008

      Let’s try that again…

      change line 31 of pngfix.php to:

      [code]';[/code]

      ReplyReply
    • MuSnake on 7 November 2008

      Plugin conflicts with my other jQuery.

      edit pngfix.php, line 31:

      `’;`

      to

      `’;`

      ReplyReply
    • [...] WP pngfix- This plugin uses CSS technique to fix the png image transparency issue and jQuery to apply this [...]

    • [...] WP pngfix- This plugin uses CSS technique to fix the png image transparency issue and jQuery to apply this [...]

    • [...] from here 15) WP pngfix- This plugin uses CSS technique to fix the png image transparency issue and jQuery to apply this [...]

    • [...] Taha Paksu desenvolveu o pngfix, um plugin para corrigir o problema do Internet Explorer 6 com transparência em figuras PNG usando [...]

    • ponche on 20 June 2008

      thanks for the help taha paksu, but i can’t improve your plugin with the lightbox.. i give up and finally i put gif instead the pngs.

      good luck with the plugin! works perfects except with lightbox!

      ReplyReply

    Leave a Reply

    Spam Protection by WP-SpamFree Plugin


Ad