通过gd库为图片添加透明水印
2008-02-15 18:19:15 来源:WEB开发网核心提示:请查看源文件注:需GD 2.0以上才能有透明效果<?phpheader ("Content-type: image/png");$logoImage = ImageCreateFromPNG('test.png');$photoImage = ImageCrea
请查看源文件
注:需GD 2.0以上才能有透明效果
<?php
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);
?>
注:需GD 2.0以上才能有透明效果
<?php
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);
?>
更多精彩
赞助商链接