Home >Backend Development >PHP Tutorial > 怎么实现类似这样的图片水印效果

怎么实现类似这样的图片水印效果

WBOY
WBOYOriginal
2016-06-13 13:17:281226browse

如何实现类似这样的图片水印效果?
http://13.images22.51img1.com/6000/qiqi1991117/31935d34aefa27067c154a2138915aa8.jpg

这个图片下方的水印,只是打上文字不足为奇,但是他在文字下方弄了一个透明的水印效果,似乎QQ空间也是这么搞的,比较好,请问下PHP如何实现这样的效果呢?



------解决方案--------------------
看看效果,参数自己调

PHP code
$fn = 'http://13.images22.51img1.com/6000/qiqi1991117/31935d34aefa27067c154a2138915aa8.jpg';
$na = md5($fn);
if(!file_exists($na)) {
  $s = file_get_contents($fn);
  file_put_contents($na, $s);
}
$im = imagecreatefromjpeg($na);

$p = imagecreatetruecolor(imagesx($im), 20);
$c = imagecolorallocate($p, 255, 255, 255);
imagefill($p, 0, 0, $c);
imagecopymerge($im, $p, 0, 20, 0, 0, imagesx($p), imagesy($p), 50); 
imagecopymerge($p, $im, 0, 0, 0, 180, imagesx($p), imagesy($p), 100); 
imagefilter($p, IMG_FILTER_BRIGHTNESS, 60);
imagecopymerge($im, $p, 0, 180, 0, 0, imagesx($p), imagesy($p), 60); 
imagejpeg($im); <div class="clear">
                 
              
              
        
            </div>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn