PHP水印问题

vinsonyin 2010-04-08 07:38:32
写了一个图片水印,但是生成的图片不是jpg格式是html,结尾写上了
header("Content-type:image/jpeg");
imagejpeg($im);
请教故障原因!
...全文
110 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
vinsonyin 2010-04-09
  • 打赏
  • 举报
回复
谢谢各位的帮助,已经解决了,是因为 没有输出后保存图片
imagejpeg($im,"保存图片.jpg");
uuq 2010-04-09
  • 打赏
  • 举报
回复
你前面有内容输出可能
xuzuning 2010-04-08
  • 打赏
  • 举报
回复
那是浏览器的问题
vinsonyin 2010-04-08
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 bing19870624 的回复:]
PHP code
<?php
// Create a blank image and add some text
$im = imagecreatetruecolor(120, 20);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, 'A Simple Text String'……
[/Quote]
哥,我想请教的是图片上加图片水印,生成的时候格式问题,我的水印生成是正常的,但是格式不是jpg,我查看图片属性的时候 是html类型,请问是什么原因?
餅餅 2010-04-08
  • 打赏
  • 举报
回复
<?php
// Create a blank image and add some text
$im = imagecreatetruecolor(120, 20);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);

// Set the content type header - in this case image/jpeg
header('Content-type: image/jpeg');

// Output the image
imagejpeg($im);

// Free up memory
imagedestroy($im);
?>

21,887

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧