解决方案 »
- php5.3.5 __set()方法报错怎么解决
- 如何写用phpmailer类发送邮件的代码?
- 强烈推荐 PHPCodeLock 免费的 php 加密软件,非常好用(如果发帖违规,请版主告知,我自行自觉删除,仅仅是想把好东西推荐给大家)
- 一个php怎么调用另一个php里面的变量?
- ZDE提示 $_SERVER['SERVER_NAME'] Undefined index 错误,但是在浏览器中又没有
- 新手求教mysql4.0中在什么地方修改character set=latin1 成 gbk?
- 点评一下这个下载文件,谢谢.
- 一个字符串替换的问题
- 诚邀北京php开发人员
- 关于php一个分也显示
- 关于分表的一些疑问
- set_error_handler()这个函数输出 PHP错误到指定的数据库里数据表的字段里面
$url = 'http://avatar.csdn.net/9/4/5/1_kenshako.jpg';
$im = imagecreatefromjpeg($url);
imagemask($im, 10, 20, 60, 40, 8);
imagepng($im);
imagedestroy($im);/**
马赛克:void imagemask ( resource image, int x1, int y1, int x2, int y2, int deep)
imagemask() 把坐标 x1,y1 到 x2,y2(图像左上角为 0, 0)的矩形区域加上马赛克。
deep为模糊程度,数字越大越模糊。
**/
/**
* GD image mask
*
* @edit www.jbxue.com
*/
function imagemask($im, $x1, $y1, $w, $h, $deep) {
$x2 = min(imagesx($im), $x1 + $w);
$y2 = min(imagesy($im), $y1 + $h);
for($x = $x1; $x < $x2; $x += $deep) {
for ($y = $y1; $y < $y2; $y += $deep) {
$color = ImageColorAt ($im, $x + round($deep / 2), $y + round($deep / 2));
imagefilledrectangle ($im, $x, $y, $x + $deep, $y + $deep, $color);
}
}
}
{
for($x = $x1; $x < $x2; $x += $deep)
{
for ($y = $y1; $y < $y2; $y += $deep)
{
$color = ImageColorAt ($im, $x + round($deep / 2), $y + round($deep / 2));
imagefilledrectangle ($im, $x, $y, $x + $deep, $y + $deep, $color);
}
}
}header("Content-type: image/png");
$im = imagecreatefromjpeg("http://avatar.csdn.net/B/D/B/1_fdipzone.jpg");
imagemask($im, 57, 60, 103, 80, 8);
imagepng($im);
imagedestroy($im);
4# 5# 都GOOD