Re: [web2py] embed image from variable

2013-11-04 Thread Josh Myers
Thank you Massimo. Everything is working now. I misunderstood something. Michele, thanks for the tip! On Thursday, October 31, 2013 1:50:02 PM UTC-4, Michele Comitini wrote: > Maybe you want "embed" in html which is much cooler it requires only one > single request/response: > > def index(

Re: [web2py] embed image from variable

2013-10-31 Thread Michele Comitini
Maybe you want "embed" in html which is much cooler it requires only one single request/response: def index(): form = SQLFORM.factory(Field('x')).process() img64 = None if form.accepted: img = myplotfunction(form.vars.x) img64 = embed64(data=img,extension='image/png') # <- !

Re: [web2py] embed image from variable

2013-10-30 Thread Massimo Di Pierro
Not sure I understand. You have every piece you need. def index(): form = SQLFORM.factory(Field('x')).process() return locals() and in index.html() {{=form}} {{if form.accepted:}} {{pass}} On Wednesday, 30 October 2013 14:55:50 UTC-5, Josh Myers wrote: > > I have all this working the s

Re: [web2py] embed image from variable

2013-10-30 Thread Josh Myers
I have all this working the same way as Massimo suggested with matplotlib, no problems. But, I can't for the life of me figure out how to pass a variable into the controller plot function from the view. This would be so I can, for example, ask the user to choose a variable through a form and t

Re: [web2py] embed image from variable

2013-01-29 Thread Massimo Di Pierro
You do not return the image that way. You need two actions, one only returns plot() (the binary data) and another would be a regular action which display a link to the other action. def myimage(): return plot() def Testing(): return dict() # in view ... On Tuesday, 29 January 2013 10:53:03 UT

Re: [web2py] embed image from variable

2013-01-29 Thread BlueShadow
I did some experimenting the problem is putting the image into the return dict() or into any variable. I got no clue how to fix it or why that is the problem. On Tuesday, January 29, 2013 5:07:16 PM UTC+1, BlueShadow wrote: > > I tried that but it doesn't show an image it puts the img tag in the

Re: [web2py] embed image from variable

2013-01-29 Thread BlueShadow
I tried that but it doesn't show an image it puts the img tag in the html code and fills the src="" with the pinary stuff but no image is displayed On Tuesday, January 29, 2013 4:53:33 PM UTC+1, rochacbruno wrote: > > I guess you can try > > >> {{=IMG(_src=plotimg)}} > > > or > > > > > --

Re: [web2py] embed image from variable

2013-01-29 Thread Bruno Rocha
I guess you can try > {{=IMG(_src=plotimg)}} or -- --- 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

[web2py] embed image from variable

2013-01-29 Thread BlueShadow
Hi, I like to add Graphs with matplotlib directly into my sites. I used a web2py slice to get an image into a variable: from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas from matplotlib.figure import Figure import cStringIO def plot(title='title',xlab='x',ylab='y',mode='