create a default/qrpage.html

insert this   {{=XML(img_tag)}}

On Wednesday, October 14, 2015 at 10:59:25 AM UTC-7, Fabiano Almeida wrote:
>
> Hi Michael,
>
> With your example, return this:
>
> Qrpage
>> StringIO:<module 'StringIO' from '/usr/lib/python2.7/StringIO.pyc'>
>> ToQRData:Fabiano Likes MLP:FIMimg:<qrcode.image.pil.PilImage object at 
>> 0x7f02d1c0a9d0>img_tag:<img 
>> src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQ4AAAEOAQAAAABQysQIAAAB0klEQVR4nO2aQY7cIBBFXwVLs4Qb5Cj4BjnT3MwcZQ4wEl6OBPpZgJ3OIhopTnpsC1YNfouvUulTRbWJT1b99hkBA/nD0rL/ksq29WU79eVMcq+HeElSgRSAmPsXSZKW08m9GlLNLAAxO5G+lx7iZGZP13JfpIVzfZFew1druR8Ss9MvZ/haLfdAJsAJqJBmh+E/jJgrRD1Zy/2QCVbbNv7dlH6AUninn/pTyb0Y0kuDtjLtQns806jIjiDJzMxCNbPgRDOKdcLmdcLms8m9FIIWX9CCE/iCFi9p8RIxu5G7xxCk7NQ6tKjSTIG4G8Xo1Y4gPVmVnVrX1nIXAC+N6B5C+uuC1B8WNlMAKTffOJPciyHNcrvv4lqZ0NK2Vw8jun+P9FutPY/5PbBbOTac4V8gyV5EfDPrnfA6tXMpn1HulZDWCZvN+6tuCtX6CqeTeyHksS/r5cJePeA0brWDSNqyFFYzYq6mhWrgCzafTe7VkH02EduAwsnm5hbP13JDZJtNpADgP1oW29xS+XRyL4u4/rqwsJVqr+NWO4BMj5t1KobPWBQQ36bnarkf8jibwGeIS52UDMDruVruh/w2m6D2YMcc6B/GbOIAYuO/OP8R+Qk7Fi5D47GUFwAAAABJRU5ErkJggg==">
>> output:<StringIO.StringIO instance at 0x7f02d1be67e8>qr:<qrcode.main.QRCode 
>> instance at 0x7f02d1bf40e0>qrcode:<module 'qrcode' from 
>> '/usr/local/lib/python2.7/dist-packages/qrcode-5.1-py2.7.egg/qrcode/__init__.pyc'>
>>
>
> How to show de picture + text message?
>
> thx
>
> 2015-10-14 13:05 GMT-03:00 Michael M <prea...@gmail.com <javascript:>>:
>
>> def qrpage():
>>     #Install Python Modules: (Pillow,qrcode)
>>     #https://github.com/lincolnloop/python-qrcode
>>     
>>     ToQRData = auth.user.username + ' Likes MLP:FIM'
>>     import qrcode
>>     import StringIO
>>     qr = qrcode.QRCode(
>>         version=1,
>>         error_correction=qrcode.constants.ERROR_CORRECT_L,
>>         box_size=10,
>>         border=1,
>>     )
>>     qr.add_data(ToQRData)
>>     qr.make(fit=True)
>>
>>     # use an in-memory object to save
>>     output = StringIO.StringIO()
>>     img = qr.make_image()
>>     img.save(output)
>>
>>     # and the use getvalue() method to get the string
>>     img_tag = '<img src="data:image/png;base64,%s">' % 
>> output.getvalue().encode('base64').replace('\n', '')
>>     return locals()
>>
>>
>> On Tuesday, October 13, 2015 at 2:05:23 PM UTC-7, Fabiano Almeida wrote:
>>>
>>> Hi all!
>>>
>>> How to dynamically generate qr code in web2py?
>>>
>>> grateful,
>>>
>>> Fabiano.
>>>
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to