问答详情
源自:3-3 给图片添加图片水印—保存和销毁图片

这段代码怎么错了

<?php 

$src="picture.jpg";

$info=getimagesize($src);

$type=image_type_to_extension(info[2],false);

$fun="imagecreatefrom{$type}";

$image=$fun($src);

$image_mark="mark.jpg";

$info2=getimagesize($image_mark);

$type2=image_type_to_extension(info1[2],false);

$fun2="imagecreatefrom{$type1}";

$mark=$fun2($image_mark);

//合并图片

imagecopymerge($image,$mark,20,30,0,0,$info2[0],$info2[1],30);//从水印图片的左上角复制整张图片到原图上

//销毁水印图片

imagedestroy($mark);

/*输出图片*/

header("Content-type:",$info['mime']);

$func="image{$type}";

$func($image);

imagedestroy($image);

 ?>

Notice: Use of undefined constant info - assumed 'info' in D:\xampp\htdocs\img\imageMark.php on line 4

Warning: image_type_to_extension() expects parameter 1 to be long, string given in D:\xampp\htdocs\img\imageMark.php on line 4

Fatal error: Call to undefined function imagecreatefrom() in D:\xampp\htdocs\img\imageMark.php on line 6


提问者:慕粉1115079975 2016-12-23 00:24

个回答

  • 慕粉1115079975
    2016-12-23 00:29:13

    $type=image_type_to_extension(info[2],false);

    $type2=image_type_to_extension(info1[2],false); 错误