为图片添加图片水印

<?php
$srcFile="../images/logo.jpg";
$dstFile="uploads/des_big.jpg";
$srcFileInfo=getimagesize($srcFile);
//print_r( $srcFileInfo);
$src_w=$srcFileInfo[0];
$src_h=$srcFileInfo[1];
$dstFileInfo=getimagesize($dstFile);
$srcMime=$srcFileInfo['mime'];
$dstMime=$dstFileInfo['mime'];
$createSrcFun=str_replace("/","createfrom",$srcMime);
$createDstFun=str_replace("/","createfrom",$dstMime);
$outDstFun=str_replace("/",null,$dstMime);
$dst_im=$createDstFun($dstFile);
$src_im=$createSrcFun($srcFile);
imagecopymerge($dst_im,$src_im,0,0,0,0,$src_w,$src_h,20);
header("content-type:".$dstMime);
$outDstFun($dst_im);
imagedestroy($src_im);
imagedestroy($dst_im);
?>

 

posted @ 2015-01-28 12:17  todaytoday  阅读(235)  评论(0编辑  收藏  举报