码迷,mamicode.com
首页 > Web开发 > 详细

php图片水印

时间:2016-09-04 22:26:35      阅读:186      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!