首页 > Web开发 > 详细

php图片水印

时间:2016-09-04 22:25:49      阅读:239      评论:0      收藏:0      [点我收藏+]
<?php
    header(‘Content-type:image/jpeg‘);
    $img=imagecreatefromjpeg(‘images/1.jpg‘);
    $img2=  imagecreatefromjpeg(‘images/2.jpg‘);
    $color= imagecolorallocate($img, 0, 0, 0);
    
    $width=imagesx($img);
    $height=imagesy($img);
    $width2=imagesx($img2);
    $height2=imagesy($img2);
    $position=imagettfbbox(20, 0, ‘font/yugang.ttf‘, ‘孙捂空‘);
    $stringwidth=$position[2]-$position[0];
    //  文字水印
    //  imagettftext($img, 14, 0, $width-1-$stringwidth-($width/30), $height-1-($height/30), $color, ‘font/yugang.ttf‘, ‘孙捂空‘);
    //  imagecopy($img, $img2, $width-1-$width2, $height-1-$height2, 0, 0, $width2, $height2);不带透明都
    imagecopymerge($img, $img2, $width-1-$width2, $height-1-$height2, 0, 0, $width2, $height2,20);
    imagejpeg($img);
    imagedestroy($img);
?>

 

php图片水印

原文:http://www.cnblogs.com/zgl-x/p/5840368.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!