Search code examples
phplaravelframeworkslaravel-8qr-code

How to generate QR CODE for dynamic generating link and logo using Simple QrCode in laravel?


I want to generate 'Image inside QR CODE' with dynamic url and Image. I have mentioned the below error and code. Used the https://www.simplesoftware.io/#/docs/simple-qrcode laravel framework to generate QR Cocde

 
<img src="data:image/png;base64, {!! base64_encode(QrCode::format('png')->merge({{ url('/') }}/{{ $card_details->profile}}, .2, true)->size(200)->generate({{ url('/') }}/{{ $card_details->card_url }})) !!} ">                  

If I give image with direct link and url, It works proper But I wanted to make it dynamic.

Error

production.ERROR: syntax error, unexpected '<' 


Solution

  • You already use tag {!! and you don't need to use {{ it anymore

    <img src="data:image/png;base64, {!! base64_encode(QrCode::format('png')->size(100)->generate(url('/qr_code/invoice?no_inv=' . $detail->waybill->encrypt_data)),
    ) !!}" style="margin-bottom: 10px;">```