时间:2021-07-01 10:21:17 帮助过:16人阅读
<?php /** * 生成水印图片 */ //1.获取图片资源 $big = imagecreatefromjpeg('./kaola.jpg'); //大图 $small = imagecreatefrompng('./t1.png'); //水印图 //2.获取图像大小 list($bw , $bh) = getimagesize('./kaola.jpg'); list($w , $h) = getimagesize('./t1.png'); //imagecopymerge(dst_im, src_im, dst_x, dst_y, src_x, src_y, src_w, src_h, pct) //imagecopymerge("目标图","水印图","目标图的x坐标","y坐标","水印图的x","y","宽","高","透明度"); imagecopymerge($big, $small, $bw-$w, $bh-$h, 0, 0, $w, $h, 40); imagepng($big , 't4.png'); imagedestroy($big); imagedestroy($small); ################################################################################## /** * 生成缩略图 */ $big = imagecreatefromjpeg('./kaola.jpg'); list($w , $h) = getimagesize('./kaola.jpg'); //创建小画布 $small = imagecreatetruecolor($w/2, $h/2); //拷贝图像并修改大小 //imagecopyresampled(dst_image, src_image, dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h) imagecopyresampled($small, $big, 0, 0, 0, 0, $w/2, $h/2, $w, $h); imagepng($small , './t6.png'); imagedestroy($big); imagedestroy($small); ?>
函数封装
相关推荐:
008-php生成随机验证码
007-PHP之GD画图流程
以上就是009-生成水印图片+生成缩略图(PHP) 的详细内容,更多请关注Gxl网其它相关文章!