My studying notes for Java,Ruby,Ajax and other any interesting things.

星期二, 八月 05, 2008

PHP中使用GD生成水印图片



  header ("Content-type: image/png");

  $logoImage = ImageCreateFromPNG('test.png');

  $photoImage = ImageCreateFromJpeg('back.jpg');

  ImageAlphaBlending($photoImage, true);

  $logoW = ImageSX($logoImage);

  $logoH = ImageSY($logoImage);

  ImageCopy($photoImage, $logoImage, 0, 0, 0, 0, $logoW, $logoH);

  ImageJPEG($photoImage); // output to browser

  ImageDestroy($photoImage);

  ImageDestroy($logoImage);

发现PHP出奇的强大和简单.

没有评论: