Pregunta

ive been reading up on QR Codes a lot recently, I want to code my own generator with PHP. But i'm having trouble, as they are rather complicated, does anyone know of any tutorials for this sort of thing?

I found this, but I get stuck when trying to convert the result from page 3 to a 11-bit binary result. I'm also confused as to why "H" ASCII value is 17 on that table, but it is 72 on the ASCII table below...

enter image description here

The main issue i'm having is generating it, I was thinking about using a table for the pixels. I want to eventually be able to generate my own QR Code like the one below, but different text in the middle and different content: I want this!

¿Fue útil?

Solución

I would suggest that you do NOT use tables for generating QR codes. This is way too much overhead for the browser, and if a browser renderes the box model that is off by 1 pixel, your whole image will be crap.

I would take a look at generating your images on the sever in php using GD2.

http://phpqrcode.sourceforge.net/

http://www.youtube.com/watch?v=sFVcOFmnZ9Y

If you really want to generate images inside the browser, you could probably get away with a HTML canvas tag.

If you want to add text I suggest you layer the text on-top using GD2. If you are using an SVG library I'm not exactly sure how to layer, but it should be simple. Here's an example of layering in GD2:

http://phpimageworkshop.com/

The thing to realize about QR codes is that they can store up to 30% redundant data. That means that you can "destroy" 30% of the code by layering an image on-top and it will still work. Here are some guides about customizing QR codes with logos etc:

http://blog.qr4.nl/post/QR-Code-Error-Recovery.aspx

http://mashable.com/2011/04/18/qr-code-design-tips/

Otros consejos

There are many php classes and external libraries available to generate QR code using php. I have listed some of them below. You can refer these links.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top