>From my point of view if you don't have a storage issue then i think
the best approach could be storing it in the file systems with name
stored in the database.  It also provides better performance when you
compare with store it in the db and retrieving.
database has to process lot and get the data, instead a file system
can process such image files much better.  I believe that performance
issue will occur each time you retrieve and display images and also
the DB will grow more when more files added...

That was my personal opinion... Maybe you guys have a different point
of view...

Cheers,
Yannick P.

On Jun 29, 4:46 am, annet <annet.verm...@gmail.com> wrote:
> In a model I defined a table:
>
> db.define_table('image',
>     db.Field
> ('bedrijf',db.bedrijf,default='',notnull=True,ondelete='CASCADE'),
>     db.Field('imagepositie',db.imagepositie,default='',notnull=True),
>     db.Field
> ('imagefile',type='upload',deletable=True,default='',notnull=True),
>     db.Field('posted_on',type='datetime'),
>     db.Field('modified_on',type='datetime'),
>     migrate='image.table')
>
> In the controller I defined two functions:
>
> @auth.requires_membership('site_manager')
> def crud_image():
>     response.functionname=T('CRUD image')
>     db.image.bedrijf.writable=False
>     db.image.bedrijf.default=auth.user.bedrijf
>     form=create_form(db.image)
>     records=db((db.image.bedrijf==auth.user.bedrijf)&
> (db.image.imagepositie==db.imagepositie.id))\
>     .select(db.image.ALL,db.imagepositie.positie)
>     return dict(form=form,records=records)
>
> @auth.requires_membership('site_manager')
> def update_image():
>     response.view='core/update.html'
>     db.image.bedrijf.writable=False
>     record=db.image[request.args[0]]
>     if not record or not record.bedrijf==auth.user.bedrijf:
>         redirect(URL(r=request,f='crud_image'))
>     form=update_form(db.image,record,'crud_image')
>     return dict(form=form)
>
> Creating, retrieving and updating an image works, but when I delete a
> record the image isn't deleted from the uploads folder. What property
> do I have to set to delete the image file from the uploads folder.
>
> I came across an example in which the developer stores the image in
> the database in a blob field, what are the pros and cons of storing
> the image in the uploads folder versus storing the image in the
> database.
>
> Kind regards,
>
> Annet.
--~--~---------~--~----~------------~-------~--~----~
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