found a solution, but it needs ugly code in the view.
And I'm not sure if this is an unsafe action.
{{import os}}
{{import base64}}
{{fh = open ( os.path.join ( 'applications', request.application,
'uploads', 'images',
'pic_%s.png' % response.Edits.id), 'rb')}}
{{data = fh.read()}}
{{fh.close()}}
{{data= base64.encodestring ( data )}}
{{data='data:image/png;base64,' + data}}
<img height="100px" <img src="{{=data}}"/>
<input name="Upload" type="file" value="Upload">
thanks,
Stef
On Mon, Feb 10, 2014 at 10:43 PM, Stef Mientki <[email protected]>wrote:
> hello,
>
> maybe I'm totally on the wrong path, but this is my script for the moment:
>
> - users can upload pictures. Uploads seems to be allowed only in
> "myapp/uploads"
>
> - I want to show these images, but images to be shown are only allowed in
> "myapp/static"
>
> - so I have to show images from "myapp/uploads"
>
> I have the following controller:
>
> def Show_Plaatje():
> fh = open ( os.path.join ( 'applications', request.application,
> 'uploads', 'images', 'pic_53.png' ), 'rb')
> data = fh.read()
> fh.close()
> return data
>
> And in my view:
> <img src="{{=URL('Show_Plaatje')}}"/>
>
> This doesn't seem to work, if I look at the resulting html-source, I see
> <img src="/Knutselen_Voor_Kinderen/default/Show_Plaatje">
>
> thanks,
> Stef
>
--
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.