barcode icon indicating copy to clipboard operation
barcode copied to clipboard

Add a centered logo in the QR Code

Open Samuel-Bie opened this issue 4 years ago • 6 comments

Hi folks, this is not an issue, i would like to know if this pckge supports adding a company logo in the center or corners of the QR Code?

Samuel-Bie avatar Dec 19 '20 15:12 Samuel-Bie

Any news ?

mariuszkrzaczkowski avatar Jun 07 '21 13:06 mariuszkrzaczkowski

Example image

mariuszkrzaczkowski avatar Jun 07 '21 13:06 mariuszkrzaczkowski

You can use Intervention Image to manipulate the QRCode. Example:

function generateQRCode($content)
{
    /**
     * result in data uri
     */
    $img = Image::make(DNS2D::getBarcodePNG($content, 'QRCODE,H', 3, 3));   
    $logo = Image::make(storage_path('template-pdf/logo-barcode.png'))->resize(42,60);

    return $img->insert($logo,'center')->encode('data-url')->encoded;
}

henrywae avatar Sep 12 '21 02:09 henrywae

what is this Image class?

mariuszkrzaczkowski avatar Sep 13 '21 06:09 mariuszkrzaczkowski

what is this Image class?

Yes, http://image.intervention.io/

Output sample, still scannable: Screenshot_20210913_143925

henrywae avatar Sep 13 '21 07:09 henrywae

This requires an additional library :/ There is no other way? Could use some built-in function for this in your library, it would make your job easier

mariuszkrzaczkowski avatar Sep 13 '21 08:09 mariuszkrzaczkowski