login/register

Snip!t from collection of Alan Dix

see all channels for Alan Dix

Snip
summary

If you have read my earlier posts, you must have seen th...
Today I have discovered that Fukuchi Kentaro, who is an ...
I have put a page on my server for you to use the functi ...
This is a demonstration of calling the page:
... e. (PS: Kaywa reader ne

Real Time QR Code Generator PHP Function | Kerem Erkan
http://keremerkan.net/posts/real-time-qr-code-generator-php-function/

Categories

/Channels/HCI stuff/mobiles

[ go to category ]

For Snip

loading snip actions ...

For Page

loading url actions ...

If you have read my earlier posts, you must have seen that I am excited about implementing QR Code to my projects. These mostly include my work projects.

Today I have discovered that Fukuchi Kentaro, who is an assistant professor has written a very useful QR Code library to use on UNIX based systems. I have immediately downloaded the library and compiled it. It ran smoothly on my server, so I created a little PHP function to use with this library, for real time QR Code generation.

I have put a page on my server for you to use the function. You can call that page supplying a base64 encoded URL and it will create a QR Code PNG on the fly.

This is a demonstration of calling the page:

http://www.keremerkan.net/qrcode/qr.php?c=aHR0cDovL2tlcmVtZXJrYW4ubmV0Lwo=

UPDATE: The page gets redirected to PHP QR Code Generator page on this blog now.

aHR0cDovL2tlcmVtZXJrYW4ubmV0Lwo= is Base64 encoded presentation of my blog URL, http://keremerkan.net/

You can easily Base64 encode this string by executing the command below from a UNIX shell:

echo http://keremerkan.net/ | openssl enc -base64

The function will only accept Base64 encoded URLs to avoid some nasty side effects. Also after decoding the URL, there should be no dangerous characters like ‘,!,<,> in the URL.

By calling the page like I gave above, you will get the image below (It is auto generated):

To read this image from your phone, you will need a QR Code reader installed on your mobile phone. You can get a QR Code reader from QuickMark or Kaywa sites for free. (PS: Kaywa reader needs you to register for download)

HTML

<p>If you have read my earlier posts, you must have seen that I am excited about implementing QR Code to my projects. These mostly include my work projects.</p> <p>Today I have discovered that <a href="http://megaui.net/fukuchi/index.en.html" target="_blank">Fukuchi Kentaro</a>, who is an assistant professor has written a very useful <a href="http://megaui.net/fukuchi/works/qrencode/index.en.html" title="QR Code library" target="_blank">QR Code library</a> to use on UNIX based systems. I have immediately downloaded the library and compiled it. It ran smoothly on my server, so I created a little PHP function to use with this library, for real time QR Code generation.</p> <p>I have put a page on my server for you to use the function. You can call that page supplying a base64 encoded URL and it will create a QR Code PNG on the fly.</p> <p>This is a demonstration of calling the page:</p> <p><del datetime="2009-07-10T22:50:45+00:00">http://www.keremerkan.net/qrcode/qr.php?c=aHR0cDovL2tlcmVtZXJrYW4ubmV0Lwo=</del></p> <p><em>UPDATE:</em> The page gets redirected to <a href="/php-qr-code-generator/">PHP QR Code Generator</a> page on this blog now.</p> <p><strong>aHR0cDovL2tlcmVtZXJrYW4ubmV0Lwo=</strong> is Base64 encoded presentation of my blog URL, <strong>http://keremerkan.net/</strong></p> <p>You can easily Base64 encode this string by executing the command below from a UNIX shell:</p> <div class="wp_syntax"> <div class="code"> <pre class="bash" style="font-family: monospace;"><span style="color: rgb(122, 8, 116); font-weight: bold;">echo</span> http:<span style="color: rgb(0, 0, 0); font-weight: bold;">//</span>keremerkan.net<span style="color: rgb(0, 0, 0); font-weight: bold;">/</span> <span style="color: rgb(0, 0, 0); font-weight: bold;">|</span> openssl enc <span style="color: rgb(102, 0, 51);">-base64</span> </pre></div> </div> <p>The function will only accept Base64 encoded URLs to avoid some nasty side effects. Also after decoding the URL, there should be no dangerous characters like &#x2018;,!,&lt;,&gt; in the URL.</p> <p><del datetime="2009-07-10T22:55:58+00:00">By calling the page like I gave above, you will get the image below (It is auto generated):</del></p> <p style="text-align: center;"><img src="/images/qr_blog.png" width="135" height="135"></p> <p>To read this image from your phone, you will need a QR Code reader installed on your mobile phone. You can get a QR Code reader from <a href="http://www.quickmark.com.tw/English/download.html" title="QuickMark Reader" target="_blank">QuickMark</a> or <a href="http://reader.kaywa.com/" title="Kaywa Reader" target="_blank">Kaywa</a> sites for free. (PS: Kaywa reader needs you to register for download)</p>