课程/PHP/后端开发
GD库实现图片水印与缩略图
-
-
原来不语
2016-12-15
- //水印操作图片
// $angle=0水平,>0旋转
public function fontMark($content,$font_url,$size,$color,$local,$angle)
{ //设置字体颜色和透明度
$col = imagecolorallocatealpha($this->image,$color[0],$color[1],$color[2],$color[3]);
//写入文字
imagettftext($this->image,$size,$angle,$local['x'],$local['y'],$col,$font_url,$content);
}
-
0赞 · 1采集
-
-
流浪佳人纳入怀
2016-10-29
- 文字谁赢方法的调用测试!
-
截图
0赞 · 0采集
-
-
流浪佳人纳入怀
2016-10-29
- 文字水印操作封装
-
截图
0赞 · 1采集
-
-
小安Andrew
2016-10-19
- 测试水印效果
-
截图
0赞 · 0采集
-
-
小安Andrew
2016-10-19
- 添加文章水印封装
-
截图
0赞 · 0采集
-
-
林静听蝉
2015-10-11
- image.class.php
//封装成类————添加文字水印(操作图片)
public function fontMark($content,$font_url,$size,$color,$local,$angle){
$col = imagecolorallocatealpha($this->image, $color[0], $color[1], $color[2], $color[3]);
imagettftext($this->image, $size, $angle, $local['x'], $local['y'], $col, $font_url, $content);
}
test.php
<?php
require "image.class.php";
$src = "yellow.jpg";
$content = 'moe1010';
$font_url = 'msyh.ttf';
$size = 20;
$color = array(
0 => 255,
1 => 255,
2 => 255,
3 => 20
);
$local = array(
'x' => 20,
'y' => 50
);
$angle = 10;
$image = new Image($src);
//$image->thumb(300,150);
$image->fontMark($content,$font_url,$size,$color,$local,$angle);
$image->show();
$image->save("fontMark");
?>
-
截图
0赞 · 0采集