$file_name=file_get_contents("c:\\Users\\linker\\Pictures\\1.bmp");
$bytes = array();
for($i = 0; $i < strlen($file_name); $i++){
$bytes[] = ord($file_name[$i]);
}
$width=$bytes[21]*16777216+$bytes[20]*65536+$bytes[19]*256+$bytes[18];
$height=$bytes[25]*16777216+$bytes[24]*65536+$bytes[23]*256+$bytes[22];
//280 190 159600 54
$im = imagecreatetruecolor($width,$height);//图片大小
$w=0;
$h=$height-1;
$z=54;
while($h > -1){
while($w < $width){
$imgcolor = imagecolorallocate($im,$bytes[$z+2],$bytes[$z+1],$bytes[$z]);//设置一个可用的颜色
imagesetpixel($im,$w,$h,$imgcolor); //画一个单一像素(0,0坐标,点的颜色)
$w+=1;
$z+=3;
}
$h-=1;
$w=0;
}
ob_clean();
header('content-type: image/png');
imagepng($im);
imagedestroy($im);
?>