这种图片怎么生成的?

image

公众号:编程之谜
imxfly
《L05 电商实战》
从零开发一个电商项目,功能包括电商后台、商品 & SKU 管理、购物车、订单管理、支付宝支付、微信支付、订单退款流程、优惠券等
《L01 基础入门》
我们将带你从零开发一个项目并部署到线上,本课程教授 Web 开发中专业、实用的技能,如 Git 工作流、Laravel Mix 前端工作流等。
讨论数量: 4

画出来的
public function createQrCode($str)
{
$qrCode = new QrCode($str);
$qrCode->setSize(310); //设置大小
$path = config('image.img_conf.path');

    $qrCode->setWriterByName('png')
        ->setEncoding('UTF-8')
        ->setErrorCorrectionLevel(ErrorCorrectionLevel::LOW)
        ->setForegroundColor(['r' => 0, 'g' => 0, 'b' => 0])
        ->setBackgroundColor(['r' => 255, 'g' => 255, 'b' => 255]);

    // Save it to a file
    $resultpath = $this->mkdirs(storage_path($path.'/qrCode'));

    $qrCode_img =  uniqid() . '.png';
    $qrCode->writeFile($resultpath.'/'.$qrCode_img);
    return $qrCode_img;
}
7年前 评论
imxfly

@helloBear 我说的不是二维码,是那张大图。。。。。。。:see_no_evil:

7年前 评论

你可以了解下 Intervention Image
https://github.com/Intervention/image
http://image.intervention.io/
简单示例如下

        //没有文字的底图
        $img = Image::make(storage_path('/app/share_images/share_image.png')); 

        //在底图上添加文字
        $img->text(“文字文字文字文字”, 200, 90, function ($font) {
                   $font->file(storage_path('/app/fonts/msyhbd.ttf'));  //字体
                   $font->size(18);   //大小
                   $font->color('#666666');  //颜色
                   $font->align('center');   
                   $font->valign('top');    
            });
7年前 评论
imxfly

@有玩没完 好的,多谢~

7年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!