does anyone no how to make an image in IE transparent?

my images work fine in Netscape/Firefox but display with white backgrounds in IE?

i have just found this code is there away of doing this which does not use so much code.

i mean i can use this but i would rather learn the code myself for future use. (that is if MSIE decide to sort out this problem before it is needed again)

here is the code it goes on its own php page and only searches for images with .png extension.

function replacePngTags($x,$img_path='',$sizeMeth='scale',$inScript=FALSE){
    // make sure that we are only replacing for the Windows versions of Internet
    // Explorer 5.5+
    if( !isset($_SERVER['HTTP_USER_AGENT']) ||
        !preg_match($msie,$_SERVER['HTTP_USER_AGENT']) ||
        return $x;

        // first, I want to remove all scripts from the page...

    // find all the png images in backgrounds
        // simply replace:
        //  "background-image: url('image.png');"
        // with:
        //  "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(
        //      enabled=true, sizingMethod=scale, src='image.png');"
        // I don't think that the background-repeat styles will work with this...
                'Microsoft.AlphaImageLoader(enabled=true, sizingMethod='.$sizeMeth.
                ', src=\''.$background[2][$i].'\');',$x);

    // find all the IMG tags with ".png" in them
        // for each found image pattern
        $atts=''; $width=0; $height=0; $modified=$original;

        // We do this so that we can put our spacer.png image in the same
        // directory as the image - if a path wasn't passed to the function
                // this was a relative URI, image should be in this directory
                array_pop($tmp);    // trash the script name, we only want the directory name
        }else if(substr($img_path,-1)!='/'){
            // in case the supplied path didn't end with a /

        // If the size is defined by styles, find them
        if(is_array($arr2) && count($arr2[0])){
            // size was defined by styles, get values

            // remove the width and height from the style
            $stripper=str_replace(' ','\s','/('.$arr2[2][0].'|'.$arr2[5][0].')/');
            // Also remove any empty style tags
            // size was not defined by styles, get values from attributes
            if(is_array($arr2) && count($arr2[0])){
                // remove width from the tag
            if(is_array($arr2) && count($arr2[0])){
                // remove height from the tag

        if($width==0 || $height==0){
            // width and height not defined in HTML attributes or css style, try to get
            // them from the image itself
            // this does not work in all conditions... It is best to define width and
            // height in your img tag or with inline styles..
                // image is on this filesystem, get width & height
            }else if(file_exists($_SERVER['DOCUMENT_ROOT'].$images[3][$num_images])){
                // image is on this filesystem, get width & height
        // end quote is already supplied by originial src attribute
        $replace_src_with=$quote.$img_path.'spacer.png'.$quote.' style="width: '.$width.
            '; height: '.$height.'; filter: progid:DXImageTransform.'.
            'Microsoft.AlphaImageLoader(src=\''.$images[3][$num_images].'\', sizingMethod='.

        // now create the new tag from the old
            str_replace('  ',' ',$modified));
        // now place the new tag into the content
        // before the return, put the script tags back in. (I was having problems when there was
        // javascript that had image tags for PNGs in it when using this function...
    return $x;

i found the code on this website i took all the copy right info off so it would display easier on this thread.

or javascript

* Correctly handle PNG transparency in Win IE 5.5 & 6. Updated 18-Jan-2006. Use in with DEFER keyword wrapped in conditional comments: */ var arVersion = navigator.appVersion.split("MSIE") var version = parseFloat(arVersion[1]) if ((version >= 5.5) && (document.body.filters)) { for(var i=0; i" img.outerHTML = strNewHTML i = i-1 } } }