Generate Qrcode from a file

Asked

Viewed 381 times

2

I create PHP files, and I wanted to add a Qrcode image of each file to download it. The files are PDF and SVG.

  • I create a file with fwrite and then use <a href="$namefile">$namefile</center></a> for the download.

1 answer

3

PHP QR Code

PHP QR Code is an open source library (LGPL) for generating QR Code images.

Based on libqrencode C library, provides an API to create QR Code barcode images (PNG, JPEG thanks to GD2).

Implemented purely in PHP, no external dependencies (except GD2 if necessary).

Example

include('qrlib.php');

// saída direta para o navegador da imagem com o QR Code na forma de PNG
QRcode::png('Dados aqui que pode ser o caminho completo para o ficheiro');

For the output to be applied to the page, you can use something like:

// tag <img/> com caminho para o PHP que gera o QR Code
echo '<img src="qrcode_do_meu_ficheiro.php" />';

You can consult the countless examples directly on the library website.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.