TinyButStrong - the PHP Template Engine
Categories > TinyButStrong general >

Dynamic generated images (like QR code)

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs

By: JimH
Date: 2015-07-23
Time: 16:28

Dynamic generated images (like QR code)

Is it possible to make use of dynamically generated images such as QR codes. There are lots of nice PHP QR code scripts on the internet that give an image as output. Can this image be used to change an image inside a template? (without saving it to the filesystem first)
By: Edwin Stas
Date: 2015-07-24
Time: 14:55

Re: Dynamic generated images (like QR code)

Hi JimH,
I use PHPQRcode from http://phpqrcode.sourceforge.net/ together with OpenTBS en Docx. But not the way you want, like a streaming image. This would be a nice feature.
In my php classe, I have following code
QRcode::png($qrlink, $filename, $errorCorrectionLevel, $matrixPointSize, 2);
which saves an QRcode (png image) to the filesystem. Than you can pickup the images inside your Docx template.

If you where using html templates than it is much easier. Just call the PHPQRCode script inside your html template and echo the result like this
echo '<img src="'.$PNG_WEB_DIR.basename($qrfile).'" />';
By: JimH
Date: 2015-07-27
Time: 10:21

Re: Dynamic generated images (like QR code)

Thank you Edwin Stas, I tried it and this works great.
You are right, for html templates this works very well. I'm going to use it this way for now and hope Skrol29 will come with a sollution for the "streaming images" for other template formats (if it is possible ofcource)
By: Edwin Stas
Date: 2015-07-27
Time: 10:46

Re: Dynamic generated images (like QR code)

You are welcome.
PHPqrcode is not the only script you can use for your QRcodes. If you are using mPDF (http://www.mpdf1.com/mpdf/index.php) which is another great script, you already have a QRcode generator inside. This uses the qrcode.class from Spipu (http://prgm.spipu.net/php_qrcode) This way you do not have to use different scripts.

For those interested: I use TBS together with Joomla and mPDF (last for generating PDF files from my TBS html templates). I also use OpenTBS for customers who want other templates and formats (docx and xlsx) for their product sheets. 

All are free scripts that these great developers made for us to use. I salute you all - great work ;-)