You need to rename your images. This is easy

instead of myimage.png you can use gis_marker.image.myimage.png

make sure "myimage" does not contain spaces or other special
characters.

web2py (T2/T3) needs to figure out from the image name which table and
which field stores the reference to the image. This may be required
for access control and other features.

Massimo

On Jan 7, 4:01 pm, Fran <francisb...@googlemail.com> wrote:
> I want to pre-populate the database with a whole bunch of images.
> Since the 'upload' field is fundamentally a string containing the
> filename I hoped to do so like this if I store the file in /uploads:
> db['%s' % table].insert(
>         image="marker.png"
>     )
>
> This works in appadmin, but not in the application (using def
> download: t2.download())
> It sees a URL like this:
> /a/c/download/marker.png
> & wants one like this:
> /a/c/download/
> gis_marker.image.bcb92188-0268-40fd-933b-7321034d322b.png
>
> I really want to be able to store in subfolders too, so using:
> image="markers/marker.png"
> This doesn't even work in appadmin since it expects the URL bit before
> the filename to be 'download':
> File "web2py/applications/sahana/controllers/appadmin.py", line 96, in
> download
>     table,field=filename.split('.')[:2]
> ValueError: need more than 1 value to unpack
>
> What would be lovely is 2 things:
> (1) Ability to pre-load a database from a folder full of files
> (2) Be able to specify a sub-folder in SQLFIELD 'upload' definitions
> (or in a validator if easy)
>
> The 1st is my main concern right now...
>
> Many thanks,
> Fran.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to