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

php图片文字水印

时间:2016-09-04 22:20:56      阅读:203      评论:0      收藏:0      [点我收藏+]

标签:

<?php
    header(‘Content-type:image/jpeg‘);
    $width=‘‘;
    $height=‘‘;
    $img=imagecreatefromjpeg(‘images/1.jpg‘);
    $color= imagecolorallocate($img, 0, 0, 0);
    
    $width=imagesx($img);
    $height=imagesy($img);
    $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‘, ‘孙捂空‘);
    imagejpeg($img);
    imagedestroy($img);
?>

 

php图片文字水印

标签:

原文地址:http://www.cnblogs.com/zgl-x/p/5840355.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!