But what about when you accumulate many thousands of images? Putting them all into one directory is going to stress the operating system, if not cause an outright crash, won't it? I suppose we could change the file storage scheme to break the images into subdirectories, but this gets more and more complicated compared with just storing the images as blobs.
Plus, suppose you want to load balance? Now you have multiple servers on which the application resides. I suppose this is a problem for the database, too, but I can only imagine the problems with distributing image files among cooperating servers and finding them all again. I would like to someday do a photo website using web2py, but these kind of questions I find very daunting. Scalability is always hard when you have a real application! On Jun 29, 12:52 pm, Yannick <[email protected]> wrote: > 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 <[email protected]> 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

