What have you tried?

Have you ever gotten *any* graphic image onto a web page with web2py?
I'd start with a known image at a known location.

and for debugging purposes, I'd add to your default/index.html a line
that said
<h2>Image from url: {{=image}} </h2>
Just to make sure I passed the right URL to the view.

That would be a start.


One thing I see, but I may be wrong.  If your file is a gif file,
shouldn't the controller line
>         image=URL(r=request,f='cavityflow_plot')
be
>         image=URL(r=request,f='cavityflow_plot.gif')
?

On Aug 22, 6:10 am, Henri Heinonen <henri.heino...@gmail.com> wrote:
> default/index.html:
> {{extend 'layout.html'}}
> <h1>cavityflow</h1>
> {{=form}}
> {{if image:}}
> <hr />
> <h2>Figure</h2>
> <img src="{{=image}}" alt="loading..."/>
> {{pass}}
>
> default.py:
> def index():
>     form=FORM('nx:', INPUT(_name='nx', _value=20.0), BR(), 'ny:',
> INPUT(_name='ny', _value=20.0), BR(), 'nt:', INPUT(_name='nt',
> _value=100.0), BR(), 'nit:', INPUT(_name='nit', _value=100.0), BR(),
> 'dt:', INPUT(_name='dt', _value=0.01), BR(), 'vis:',
> INPUT(_name='vis', _value=0.1), BR(), 'rho:', INPUT(_name='rho',
> _value=1.0), BR(), INPUT(_type='submit',_value='Make figure'))
>
>     image=None
>     if form.accepts(request.vars, session, keepvalues=True):
>         session.flash = 'Form accepted.'
>         session.nx=float(request.vars.nx)
>         session.ny=float(request.vars.ny)
>         session.nt=float(request.vars.nt)
>         session.nit=float(request.vars.nit)
>         session.dt=float(request.vars.dt)
>         session.vis=float(request.vars.vis)
>         session.rho=float(request.vars.rho)
>         image=URL(r=request,f='cavityflow_plot')
>     return dict(form=form, image=image)
>
> def cavityflow_plot():
>     return cavityflow(session.nx, session.ny, session.nt, session.nit,
> session.dt, session.vis, session.rho)
>
> def cavityflow(nx, ny, nt, nit, dt, vis, rho):
> ...*clip* *clip* ... # Here the application will make one hundred png
> images.
>            os.system("convert *.png cavityflow.gif")
> # What do I need to add in here in order to return the cavityflow.gif
> onto the webpage of my application?
>
> The question is in the source code as a comment line.
>
> Yours sincerely, Henri Heinonen.

Reply via email to