我有一个数组,下面是它的一部分(它超过3000项)我需要将字节数据转换为图像(jpg)任何想法我是如何做到的?
感谢。
[0] => 255
[1] => 216
[2] => 255
[3] => 224
[4] => 0
[5] => 16
[6] => 74
[7] => 70
[8] => 73
[9] => 70
[10] => 0
[11] => 1
[12] => 1
[13] => 1
[14] => 0
[15] => 96
[16] => 0
[17] => 96
[18] => 0
[19] => 0
[20] => 255
答案 0 :(得分:0)
这应该有效
$fp = fopen("image.jpg", "wb");
$len = count($array);
for ($i = 0; $i < $len; $i++) {
$data = pack("C*",$array[$i]);
fwrite($fp, $data);
}
fclose($fp);
从here
采用