Laravel实时生成图片

201次阅读
没有评论

图片下载

public function generateQRCode($id){$result = SenceQrcodeInfo::find($id,['qrcode_content','id']);
        $url = "http://weixin.qq.com/q/02_lvVoNRJe7h10000003X";
        //echo "<img src=\"data:image/png;base64,".base64_encode(QrCode::format('png')->size(300)->generate($url))."\">";
        return response()->stream(function() use($result){echo QrCode::format('png')->size(200)->generate($result->qrcode_content);
        }, 200, ["Content-type"=>"image/png","Content-Disposition"=>"attachment; filename=hello.png"]);
    }

图片在线预览

public function generateQRCode($id){$result = SenceQrcodeInfo::find($id,['qrcode_content','id']);
        $url = "http://weixin.qq.com/q/02_lvVoNRJe7h10000003X";
        //echo "<img src=\"data:image/png;base64,".base64_encode(QrCode::format('png')->size(300)->generate($url))."\">";
        return response()->stream(function() use($result){echo QrCode::format('png')->size(200)->generate($result->qrcode_content);
        }, 200, ["Content-type"=>"image/png"]);
    }
正文完
有偿技术支持加微信
post-qrcode
 
评论(没有评论)
验证码