= 3) { $c0 = ord($image[0]); $c1 = ord($image[1]); $c2 = ord($image[2]); if (($c0 == 0x47) && ($c1 == 0x49)) $contentType = "image/gif"; else if (($c1 == 0x50) && ($c2 == 0x4e)) $contentType = "image/png"; else if (($c0 == 0x42) && ($c1 == 0x4d)) $contentType = "image/bmp"; else if (($c0 == 0xff) && ($c1 == 0xd8)) $contentType = "image/jpeg"; else if (($c0 == 0) && ($c1 == 0)) $contentType = "image/vnd.wap.wbmp"; else if (($c0 == 0x1f) && ($c1 == 0x8b)) header("Content-Encoding: gzip"); } header("Content-type: $contentType"); if ($filename != null) header("Content-Disposition: inline; filename=$filename"); print $image; ?>