本篇文章介绍的内容是 生成水印图片和生成缩略图(PHP) ,现在分享给大家,有需要的朋友可以看一下
<?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); ?>
函数封装
https://blog.csdn.net/liguanjie8/article/details/79835373
相关推荐:
Atas ialah kandungan terperinci 009-生成水印图片+生成缩略图(PHP) . Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!