php 生成的图像未在网络视图中显示

php generated images not showing in webview

我有一个带有网络视图的 android 应用程序。 在网络视图中,我有一些 php 生成的图像 (GDLIB)

<!-- Show a php generated image from GDLIB -->
<img src='graphs/graph.php'>

<?
// Graph.php
$src = imagecreatefrompng('mapStatus.png');
$dstC = imagecreatefromgif('pointClosed.gif');
$text_color=ImageColorAllocate($src,255,255,255);
imagecopymerge($src,$dstC,22,15,0,0,4,4,95);
header('Content-type: image/png');
imagepng($src);
imagedestroy($src);
?>

出于某种原因,这些图像没有显示在网络视图中,但它们在常规浏览器中工作正常window。 用非 php 生成的图像替换路径效果很好。

是否有一些解决方法,以便我可以在网络视图中显示 php 生成的图像?

编辑: Webview 显示损坏的图像,如下所示:

而不是应该看起来像这样的实际图片:

谢谢

尝试:

  • Double-checking 你的亲戚 URL.
  • 指定 headers.

    header('Content-Type: image/png');

有了上面的图像输出,您的浏览器就不必假定它可能正在做的内容类型。

检查您的控制台是否有 40X/500 错误和 "expected type image/png but received text/html" 或类似错误。