<?php
header("Content-type: image/gif");
//it doesn't matter if it is image/gif, image/jpeg or image/png
$imagename="bla/bla.jpg"; //name & path of img
$gettype=getimagesize($imagename);
switch ($gettype[2]){
case 1: $ext="gif"; break;
case 2: $ext="jpeg"; break;
case 3: $ext="png"; break;
}
eval("\$image=imagecreatefrom".$ext."(\"".$imagename."\");");
eval("image".$ext."(\$image);");
?>
The only problem is that you must have php with gd library installed (./configure --with-gd). However newest versions of gd DOESN'T support gif images, oldest - png! Pity for that!