我有水印文字的代码到图像放置图像水印
if($type==".jpg" or $type==".jpeg"){
$im = imagecreatefromjpeg($uploaddir.$randnum);
}elseif($type==".gif"){
$im = imagecreatefromgif($uploaddir.$randnum);
}else{
$im = imagecreatefrompng($uploaddir.$randnum);
}
$imagesize = getimagesize($uploaddir.$randnum);
$x_offset = 7;
$y_offset = 8;
$textcolor = imagecolorallocate($im, 0xCC, 0xCC, 0xCC);
$textcolor2 = imagecolorallocate($im, 0x00, 0x00, 0x00);
imagestring($im, 5, $x_offset, $y_offset, strtoupper($_POST['code']), $textcolor2);
if($type==".jpg" or $type==".jpeg"){
imagejpeg($im,$uploaddir.$randnum,100);
}elseif($type==".gif"){
imagegif($im,$uploaddir.$randnum,100);
}else{
imagepng($im,$uploaddir.$randnum,8);
}
上面的代码打印在左上角的水印......但我想它要对在底部写对。
任何帮助家伙
问候
没有亲爱的不工作 – 2012-02-23 22:34:33
当你这样做时发生了什么?水印有多高?它需要是图像的大小减去水印的大小。我只是猜测水印的高度为'7'。 – cegfault 2012-02-23 22:38:23
水印是文字而不是图像亲爱的 – 2012-02-23 22:52:33