本篇文章介紹的內容是生成水印圖片和生成縮圖(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
#相關推薦:
以上是009-生成水印圖片+生成縮圖(PHP)的詳細內容。更多資訊請關注PHP中文網其他相關文章!