thinkphp 添加多个水印

public function share()
    {
        $detail = array(
            'lawyer_name' => '律师姓名:李三',
            'lawyer_tel' => '律师电话:17758002383',
            'lawyer_email' => '联系邮箱:569543417@qq.com',
            'lawyer_office' => '浙江易盟律师事务所',
            'lawyer_good' => '擅长领域:婚姻家庭, 房产纠纷, 债务纠纷',
            'lawyer_office_address' => "律所地址:浙江省杭州市西湖区古墩路同人精华大厦一座122室"
        );
        $image_url = APP_ROOT . SKIN . 'share_image/weilvshi/';
        $basic_image = $image_url . 'weilvshi.jpg';
        $ttf = 'msyh.ttc';
        $img = time() . rand(0000, 9999) . '.png';
        $start_img = $image_url . $img;
        $test_height = 50;
        $test_width = 66;
        $image = new \Think\Image();
        $image->open($basic_image)->save($start_img);
        foreach ($detail as $k => $v) {
            if (strlen($v) > 60) {
                $v = chunk_split($v, 60, "\n");
            }
            $image->open($start_img)->text($v, $ttf, '18px', '#ffffff', array($test_width, $test_height))->save($start_img);
            $test_height = $test_height + 40;
        }
    }

评论 抢沙发

表情