douzi1991 2010-12-17 16:22
浏览 24
已采纳

PHP显示为图像

I am trying to make a PHP page load an image and display, as if it were an image file. Here's what I tried to do:

header("Content-type: image/png"); 
echo base64_encode(file_get_contents($ad->location));

But this doesn't seems to work. How should this be done?

Thank you.

  • 写回答

1条回答 默认 最新

  • duanqie8549 2010-12-17 16:23
    关注

    You don't need to base64 encode image data when outputting it as a file. Just pass it through.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 c++ gmssl sm2验签demo
  • ¥15 关于模的完全剩余系(关键词-数学方法)
  • ¥15 有没有人懂这个博图程序怎么写,还要跟SFB连接,真的不会,求帮助
  • ¥15 关于移动机器人坐标计算
  • ¥30 模拟电路 logisim
  • ¥15 PVE8.2.7无法成功使用a5000的vGPU,什么原因
  • ¥15 is not in the mmseg::model registry。报错,模型注册表找不到自定义模块。
  • ¥15 安装quartus II18.1时弹出此error,怎么解决?
  • ¥15 keil官网下载psn序列号在哪
  • ¥15 想用adb命令做一个通话软件,播放录音