您的位置:首页 > 编程语言 > PHP开发

php GD库的使用:处理图像的功能

2017-10-19 01:25 477 查看
 php GD库的使用:处理图像的功能
    使用:1.画布 2.画笔 3.写字 4.画点/画线
    建立图像:$image = imagecreatetruecolor(画布宽,画布高);
    设置背景/字体颜色:$color = imagecolorallocate($image,0,0,0);
    对画布背景填充颜色:imagefill($image,0,0,$color);
    把字符串写在图像:imagestring($image,字体大小,x,y,'string',$color);
    画点:imagesetpixel($image,x,y,$color);
    画线:imageline($image,x1,y1,x2,y2,$color);
    输出图像:header("Content-type:image/jprg");
    imagejpeg($image);
    释放内存:imagedestroy($image);
    生成更好的随机数:mt_rand( );
    引入自定义字体:imagettftext($image,大小,角度,x,y,$color,$font,'string');
    存内容到文本文件:file_put_contents($file(文件路径),$content);
     file_set_contents($file);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: