pngfix Wordpress Plugin
May 9th, 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 :
.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 :
$(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 :
- Upload ‘wp-pngfix’ directory to the ‘/wp-content/plugins/’ directory
- Activate the plugin through the ‘Plugins’ menu in WordPress
- 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
People who looked at this item also looked at…
Related items


















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.
Is the plugin still working after you did that?
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
Is it compatible with wordpress 2.7.1 ? Please help…
heres the link
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
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($){“).
Hey kardasi! This might be useful, i will test it out later!
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
Voya : Thank you
I’ll try that
getting closer…
change source attribute of line 31 of pngfix.php to:
[code] '. ABSPATH . WPINC . '/js/jquery.js[/code]
Let’s try that again…
change line 31 of pngfix.php to:
[code]';[/code]
Plugin conflicts with my other jQuery.
edit pngfix.php, line 31:
`’;`
to
`’;`