如果我在一个变量中有一个图像的二进制数据,我如何将其显示在html页面(PHP)中给用户


If i have the binary data of an image inside a variable, how can i show it to the user into an html page (PHP)

im使用WideImage库对图像进行一些修改,当处理完成时,图像的二进制数据由$new->output('jpg', 90);返回。问题是输出是一个二进制数据,我不能与<IMG SRC="image.jpg">一起使用。如何调整代码?感谢

只需在用户请求图像时将其回显给用户即可。

这是典型的模式:

<img src="image.php?image_id=23423">

这就是你在PHP 中所做的

header("Content-Type: image/jpeg");
echo $new->output('jpg', 90);