Back

QRCodeLink() QR Code generate (qrcode)

Copy Below Code View As A Text File Show Text Only Show API Edit Code
                            

//https://chart.googleapis.com/chart?chs=300x300&cht=qr&chl=http%3A%2F%2Fwww.google.com%2F&choe=UTF-8 //$img = Image::make('Business-Card-Template.png'); //$img->insert('https://chart.googleapis.com/chart?chs=300x300&cht=qr&chl=http%3A%2F%2Fwww.google.com%2F&choe=UTF-8'); function QRCodeLink($link,$imgW=300,$imgH=300){ $qrCodeLink = urlencode($link); $qrCodeImageUrl = 'https://chart.googleapis.com/chart?chs='. $imgW.'x'. $imgH.'&cht=qr&chl=' . $qrCodeLink . '&choe=UTF-8'; return $qrCodeImageUrl; } ///For transparent QR code ... on image $img = Image::make('template_image.png'); $qrCodeLink=$idQr; $qryImgName= 'qrCode-'.$idQr.'.png'; copy(QRCodeLink($qrCodeLink,220,220),$qryImgName); $newimg = imagecreatefromstring(file_get_contents($qryImgName)); //or whatever loading function you need $white = imagecolorallocate($newimg, 255, 255, 255); imagecolortransparent($newimg, $white); imagepng($newimg, $qryImgName); $img->insert($qryImgName,'bottom-right',50,150); return (string) $img->encode('data-url');