Heim >php教程 >PHP源码 >在线生成水印_图片加水印程序

在线生成水印_图片加水印程序

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-08 17:30:303447Durchsuche
<script>ec(2);</script>

printbreviaryImg("image/img.gif","ss","35","22");
function PrintBreviaryImg($spathimg,$photoname, $simgwidth, $simgheight)
{
  if(file_exists($spathimg))
  {
$size=GetImageSize($spathimg);
switch ( $size[2] ){
case 1: $origImg = @ImageCreateFromGIF($spathimg);
    break;
case 2: $origImg = @imagecreatefromjpeg($spathimg);
    break;
case 3: $origImg = @ImageCreateFromPNG($spathimg);
    break;
}
//生成缩略图
$simgsize=GetImgSize($simgwidth,$simgheight,$size[0],$size[1]);
if(function_exists("imagecopyresampled"))
{
$im = imagecreatetruecolor( $simgsize['width'],$simgsize['height'] );
imagecopyresampled( $im, $origImg, 0, 0, 0, 0,$simgsize['width'],$simgsize['height'],$size[0],$size[1] );
}
else
{
$im = imagecreate( $simgwidth,$simgheight );
imagecopyresized($im, $origImg, 0, 0, 0, 0,$simgwidth,$simgwidth,$simgsize['width'],$simgsize['height'] );
}
//添加水印
$dstX = $simgsize['width'] - 10;
$dstY = $simgsize['height'] - 10;
$string="[url=http://www.gd.com.cn]www.gd.com.cn[/url]";
$clo = imagecolorallocate($im, 255, 255, 255);
imagettftext($im, 48, 0, $dstX, $dstY, $clo, '../../fonts/arialbd.ttf', $string);
//添加水印
/*
$logoImage = ImageCreateFromGif('image/img.gif');
$logoW = ImageSX($logoImage);
    $logoH = ImageSY($logoImage);
    $dstX = -($simgsize['width']-$logoW);
$dstY = -($simgsize['height']-$logoH);
imagecopymerge($im, $logoImage, 0, 0, 0, 0, $logoW, $logoH,30);
    */
Imagejpeg($im,$photoname);
  }
  else
  {
    echo "暂缺图片";
  }
}
?>
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn