PHP - 图片处理 - 图片写字

getTablePicture 方法为图片写字:

private function getTablePicture($file,$koubei,$src='',$size=[])
    {
        $src = $src?:$file;
        $stage = new ZStage(680,680); // 初始化图片对象
        $bitmap_data = new ZBitmapData($src); // 定义图片内容,格式,尺寸等
        $bitmap = new ZBitmap($bitmap_data,0,110); // 图片对象赋值
        $bitmap->center();  // 图片对象居中
        if($size){
            $bitmap->setSize($size[0],$size[1]);
        }
        $type = TableType::find($koubei['type_id']);
        $type_name = $type?$type['name']:'普通桌';
        $text_type = new ZText('桌位类型:'.$type_name);
        $text_type->left();
        $text_type->setY(60);
        $text_type->offsetX(60);

        $text_code = new ZText('桌号:'.$koubei['name']);
        $text_code->right();
        $text_code->setY(60);
        $text_code->offsetX(-60);

        $store = \App\Models\Store::find($koubei['store_id']);
        $store_name = $store?$store->name:'总店';
        if($koubei['multi_store_id']){
            $multi = StoreMulti::find($koubei['multi_store_id']);
            if($multi){
                $store_name = $multi->name;
            }
        }
        $text_s
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值