
Because versions of Microsoft Internet Explorer before version 7 can't handle
the Alpha transparency when rendering pictures, I've decided to go for the quick
and easy way: a script converting PNG to GIF on the fly. The script only accepts
pictures from its own website.
Usage: the query string (after the ?) is the
relative-path/absolute-path/url to the PNG file. This file should be a 24 bits
PNG with an alpha transparency layer that'll convert to the color black.
Benjamin B. for TuVasVoir

Parce que les versions d'Internet Explorer de Microsoft d'avant la version 7 ne
savent pas prendre en compte la transparence Alpha pour afficher des images, je
me suis décidé à y aller simplement: un script convertissant les PNG en GIF à la
volée. Le script n'accepte que les images de son propre site web.
Utilisation
: la requête (après le ?) est le chemin-relatif/chemin-absolu/url vers le PNG.
Ce fichier devra être un PNG 24 bits avec une couche de transparence alpha qui
se convertira en la couleur noir.
Benjamin B. pour TuVasVoir
<?php $r = $_SERVER['QUERY_STRING']; $s = 'http://'.$_SERVER['HTTP_HOST']; if ($r == '') { header('HTTP/1.1 301 Moved Permanently');header('Location: demonstration.php');} else { if (substr($r, 0, strlen($s)) == $s) $r = substr($r,strlen($s)); if ($r[0]=='/')$r=$_SERVER['DOCUMENT_ROOT'].$r;else $r=dirname(__FILE__).'/'.$r; if (file_exists($r)) { header('Content-type: image/gif'); header('Expires: '.date('r',strtotime('+4 hour'))); $gif = imagecreatefrompng($r); $tra = imagecolorallocate($gif,0,0,0); imagecolortransparent($gif,$tra); imagegif($gif); imagedestroy($gif); } } ?>
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} .*OffByOne.* [OR]
RewriteCond %{HTTP_USER_AGENT} .*MSIE\ 1.* [OR]
RewriteCond %{HTTP_USER_AGENT} .*MSIE\ 2.* [OR]
RewriteCond %{HTTP_USER_AGENT} .*MSIE\ 3.* [OR]
RewriteCond %{HTTP_USER_AGENT} .*MSIE\ 4.* [OR]
RewriteCond %{HTTP_USER_AGENT} .*MSIE\ 5.* [OR]
RewriteCond %{HTTP_USER_AGENT} .*MSIE\ 6.*
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*).png$ /_/png2gif4ie6/?$1.png [L]