写了一个图片水印,但是生成的图片不是jpg格式是html,结尾写上了
header("Content-type:image/jpeg");
imagejpeg($im);
请教故障原因!
 

解决方案 »

  1.   

    <?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);
    ?> 
      

  2.   

    哥,我想请教的是图片上加图片水印,生成的时候格式问题,我的水印生成是正常的,但是格式不是jpg,我查看图片属性的时候 是html类型,请问是什么原因?
      

  3.   

    谢谢各位的帮助,已经解决了,是因为 没有输出后保存图片
    imagejpeg($im,"保存图片.jpg");