[英]output an image with php script - src tag
I cannot output images on my web page on local host, 我无法在本地主机上的网页上输出图像,
I am using an images.php script, the last part is; 我正在使用images.php脚本,最后一部分是;
if ($mime) {
header('Content-type: '.$mime);
header('Content-length: '.filesize($pic));
$file = @ fopen($pic, 'rb');
if ($file) {
fpassthru($file);
exit;
}
}
My other php page includes the below code; 我的其他php页面包含以下代码;
<li><a href="http://example.com" target="_blank"><img src="images.php?key=orn"></a></li>
However, all my images like the above are broken, I debugged my images.php file with if&else's and I saw that it comes to the end with true variables. 但是,我上面的所有图像都坏了,我用if&else调试了images.php文件,发现它的末尾包含了真正的变量。
How can I find the reason? 我如何找到原因?
fpassthru? fpassthru? grammer of src?
src的语法? localhost?
本地主机? any other thing?
还有其他事吗?
$file = '../image.jpg';
$type = 'image/jpeg';
header('Content-Type:'.$type);
header('Content-Length: ' . filesize($file));
readfile($file);
You can also look into mod_xsendfile 您也可以查看mod_xsendfile
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.