brata-hsdc / brata.masterserver

Behind-the-scenes coordination and support for the HSDC
Apache License 2.0
1 stars 0 forks source link

Generate QR Codes with qrcode module #99

Open ellerychan opened 8 years ago

ellerychan commented 8 years ago

Generate QR codes and insert them into web pages using the local qrcode module instead of accessing a web service. The MS may not have Internet access in certain situations, preventing QR codes from being generated by an Internet web service. The qrcode module will generate the QR codes on the local host.

jaron42 commented 8 years ago

Still hoping you might have an implementation better than mine, but I got my slow png implementation at least working for today.

ellerychan commented 8 years ago

@jaron42: I'm merging in my change. I'm not exactly sure what you want the qrcode url to do, so I only modified the get method behavior slightly: it used to return just an image; now it returns a web page that displays the QR code image and the text below it.

I don't know if it is slow. To me the delay doesn't seem any different than for other MS requests. I also tried boosting the error correction up to ERROR_CORRECT_M, and it did not seem to take longer. I tested on the old Pi Model B+.

I added a method QRCode.makeInlineImageTag(image, altText="embedded image", imgType="png"). It encodes the pixel data so it can be embedded in the web page inside an tag. You should be able to insert these into templates. The other QR code pages could be refactored to use these embedded img tags.

ellerychan commented 8 years ago

Resolved by Pull Request #100 .

ellerychan commented 8 years ago

Maybe we should change the default image type to "gif" to reduce the data size. I made it "png" initially to make it a direct replacement for the previous functionality.

jawaad-ahmad commented 8 years ago

Is there anything left to do for this, or can it be resolved/closed?