Home >Backend Development >PHP Tutorial >大神 php生成图片问题 急

大神 php生成图片问题 急

WBOY
WBOYOriginal
2016-06-23 13:21:16888browse

    header("Content-Type:text/html;charset=utf-8");
    header("Content-type: image/jpeg");
    $image = imagecreatefromjpeg('./demo.jpg');
    $bgcolor = imagecolorallocate($image, 0, 0, 0);
    $fontcolor = imagecolorallocate($image, 255, 255, 255);
    header("Content-Disposition: attachment;filename=demo.jpg ");
    imagejpeg($image);
   imagedestroy($image);
?>
以上代码下载到本地后的图片提示:
windows 照片查看器无法打开此图片,因为此文件可能已损坏、损毁或过大。
求大神帮忙


回复讨论(解决方案)

多半是有 bom 头

我放手机上做下载,点去一点反应都没有啊,我是放手机上的
求大神,拜谢

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn