【问题标题】:php imagepng not working. shows question marksphp imagepng 不工作。显示问号
【发布时间】:2015-12-09 08:40:06
【问题描述】:

我有以下问题:imagepng、imagejpeg 无法正常工作。我在白屏上出现黑色问号(未知字符列表)。 gd2 模块已打开。 以这个简单的代码为例:

$im = imagecreatefrompng($file_name);

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

imagepng($im);
imagedestroy($im)

我错过了什么?

【问题讨论】:

    标签: php gd2


    【解决方案1】:

    这对我有用

    $im = imagecreatefrompng("1.png");
    ob_clean();
    header('Content-Type: image/png');
    imagepng($im);
    imagedestroy($im);
    

    【讨论】:

    • 不,它是 png。无论如何,我在许多图像上都尝试过,但仍然没有结果。
    • 所以不,我在不同的浏览器和 IE 作品中测试了它,但 chrome 和 firefox 仍然是问号。你知道为什么吗?
    • 试试ob_clean();header('Content-Type: image/png');
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-08-18
    相关资源
    最近更新 更多