<img src="...">

is supposed to be a link to an image, not an image. If you want to inline 
the binary data you can try:

import base64
encoded_qr_code = base64.b64encode(qr_code)

and

<img src="data:image/gif;base64,{{=encoded_qr_code}}">

May not work on older browsers.



On Wednesday, 1 October 2014 19:23:14 UTC-5, Ben Sharif wrote:
>
> I am generating a qr code using python module qrcode.
>
> I am not needing to store the qr code image in a database, just generate 
> it each time.
>
> controller:
> def create_qr():
>     text = "hello world qr code"
>     qr_code = qrcode.make(text)   
>
> view:
> <img src="{{=qr_code}}">
>
>
> doing the above, the controller is returning a PIL Image object but 
> trying to embed that image is producing no actual image. how do I get 
> web2py to display a PIL image object in the view?
>
>
>

-- 
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