码迷,mamicode.com
首页 > 其他好文 > 详细

为图片添加文字水印

时间:2015-01-28 11:07:14      阅读:192      评论:0      收藏:0      [点我收藏+]

标签:

<?php
$filename="des_big.jpg";
$fileInfo=getimagesize($filename);
//echo $fileInfo;  echo "<br>";
$mime=$fileInfo[‘mime‘]; 
//echo $mime; echo "<br>";
$createFun=str_replace("/","createfrom",$mime);
//echo $createFun; echo "<br>";
$outFun=str_replace("/",null,$mime);
$image=$createFun($filename);
//echo $image; echo "<br>";
$color=imagecolorallocatealpha($image,255,0,0,50);
$fontfile="../fonts/h.ttf";
$text="imooc.com";
imagettftext($image,14,0,0,14,$color,$fontfile,$text);
//header("content-type:".$mime);
$outFun($image,$filename);
imagedestroy($image);
echo "<img src=‘$filename‘>";
?>

 

为图片添加文字水印

标签:

原文地址:http://www.cnblogs.com/jacson/p/4255223.html

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