Ec (2); & lt ;? PhpprintbreviaryImg("imageimg.gif & quot;, & quot; ss & quot;, & quot; 35 & quot;, & quot; 22 & quot;); functionPrintBreviaryImg ($ spathimg, $ photoname, $ simgwidth, $ simgheight) {& nbsp; if (fi 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;
}
// Generate a thumbnail
$ 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, $ simgwidth, $ simgwidth, $ simgsize ['width'], $ simgsize ['height']);
}
// Add a watermark
$ 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 );
// Add a watermark
/*
$ 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 "image missing ";
}
}
?>