Ever biched over IE not being able to use transparent PNG's?

Well I have!!

Some days ago I found a link to a hack on Jakub ‘jimmac’ Steiner’s homepage.

I have now made a function in PHP which automaticaly uses this workaround in IE. Take a look at the code below.

$localDocumentRoot = str_replace($_SERVER['PHP_SELF'],
"", $_SERVER['SCRIPT_FILENAME']);

//$image is an array
/* This is a hack to use PNG transparentsy in IE */
function transparentImage($image, $ie) {
  global $localDocumentRoot;
  //The str_replace makes sure that images with spaces is also recognized
  $imageFile = getimagesize( str_replace(' ','%20',
  $localDocumentRoot.$image['src'] ) );
  if($ie) {
?>

<div


style=" filter:progid:DXImageTransform.Microsoft.\AlphaImageLoader(src='',
sizingMethod='scale');" > </div>

<img src=""



 width=""
 height=""

/>


//Now run the function
$image['src'] = "/gallery/image.png";
$image['id'] = "unique_image";
$image['class'] = "image";
$image['alt'] = "Image example with transparent PNG images";
$image['title'] = "Tooltip for image";

transparentImage($image, true);

Tomorrow I will take a look at this post to make sure that I havet posted shitty code ;) Perhapes I can find a way so that Serendipity doesn’t fuck with the layout?!

Creative Commons License
Ever biched over IE not being able to use transparent PNG's? by Jacob Emcken is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.