赞
踩
//图片水印 function img_water_mark() { $dst_path = '011.jpg'; $src_path = 'dianchao.png'; $new_img_name = '012.jpg'; //创建图片的实例 $dst = imagecreatefromstring(file_get_contents($dst_path)); $src = imagecreatefromstring(file_get_contents($src_path)); //获取水印图片的宽高 list($src_w, $src_h) = getimagesize($src_path); //获取原图的宽高 list($dst_w, $dst_h, $dst_type) = getimagesize($dst_path); //将水印图片复制到目标图片上,最后个参数50是设置透明度,这里实现半透明效果 $pos=2; /* * 10种水印效果位置 * 0:默认是随机位置 * 1:顶端居左 * 2:顶端居中 * 3:顶端居右 * 4:中部居左 * 5:中部居中 * 6:中部居右 * 7:底端居左 * 8:底端居中 * 9:底端居右 */ switch ($pos) { case 0: $pos_x = rand(0, ($dst_w - $src_w)); $pos_y = rand(0, ($dst_h - $src_h)); break; case 1: $pos_x = 0;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。