这种图片怎么生成的?

image

公众号:编程之谜
imxfly
《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
讨论数量: 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;
}
6年前 评论
imxfly

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

6年前 评论

你可以了解下 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');    
            });
6年前 评论
imxfly

@有玩没完 好的,多谢~

6年前 评论

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