php生成水印,包括位置和透明度(9)
$posX = $old_w - $water_w;
$posY = $old_h - $water_h;
break;
default: //随机
$posX = rand(0,($old_w - $water_w));
$posY = rand(0,($old_h - $water_h));
break;
}
// 设定图像的混色模式
imagealphablending($oldimg, true);
// 添加水印
imagecopymerge($oldimg, $waterimg, $posX, $posY, 0, 0, $water_w,$water_h,$pct);
$fun = 'image'.$type;
!@$fun($oldimg, $filename,100) && die('保存失败!检查目录是否存在并且可写?');
imagedestroy($oldimg);
imagedestroy($waterimg);
return $filename;
}
}
$imgs=new image();
$tempFile = "./images/hdb.jpg";
$water = "./images/bamiluo.jpg";
$imgs->param($tempFile);
//if(!$imgs->thumb($targetFile,600,500))die('fail');
$imgs->water($targetFile,$water,0,10);
echo "aaa";
?>
摘自:ws07_byyy的专栏
相关新闻>>
- 发表评论
-
- 最新评论 更多>>