Thinkphp5 实现定位水印/图片插入文字

 public function image(){
		$image = \think\Image::open(ROOT_PATH.'/sq.png');
		$image->text($user['realname'],ROOT_PATH.'/msyh.ttf',12,'#000000',[205,375]);
		$image->text($leves,ROOT_PATH.'/msyh.ttf',12,'#000000',[241,405]);
		$image->text($user['weixin'],ROOT_PATH.'/msyh.ttf',12,'#000000',[386,405]);
		$image->text($user['cardno'],ROOT_PATH.'/msyh.ttf',12,'#000000',[210,440]);
		$image->text($user['identity'],ROOT_PATH.'/msyh.ttf',12,'#000000',[240,472]);
		$stay=date("Y-m-d",$user['reg_time']);
		$yeaer=date("Y",time());
		$yeaer=$yeaer+1;
		$end=$yeaer.'-'.date("m-d",$user['reg_time']);
		$image->text($stay,ROOT_PATH.'/msyh.ttf',12,'#000000',[354,758]);
		$image->text($end,ROOT_PATH.'/msyh.ttf',12,'#000000',[462,758]);
		$image->save(ROOT_PATH.'/public/uploads/sq/sq'.$user['identity'].'.png',null,100);
		return json(array('img'=>'/public/uploads/sq/sq'.$user['identity'].'.png'));
      
    }

你可能感兴趣的:(php)