Ow Thanx, I can generate a filename fgrom a guid-probably and use this technique to 'upload' it to the database. Looks very easy indeed :-D
On 15 sep, 23:22, pbreit <[email protected]> wrote: > Not exactly what you are looking for but might give you some ideas. I use > this to create thumbnails of the uploaded image. > > Field('image', 'upload', uploadfolder=request.folder+'static/uploads', > requires=IS_EMPTY_OR(IS_IMAGE())), > Field('image_thumb', 'upload', > uploadfolder=request.folder+'static/uploads', > compute=lambda r: resize_image(r['image'], (150,130), 'thumb'), > readable=False, writable=False), > > import os.path > from PIL import Image > > def resize_image(image, size, path, rotate=0): > if image: > try: > img = Image.open('%sstatic/uploads/%s' % (request.folder, > image)) > img = img.convert("RGB") > img.thumbnail(size, Image.ANTIALIAS) > img = img.rotate(rotate) > root, ext = os.path.splitext(image) > filename = '%s_%s%s' %(root, path, ext) > img.save('%sstatic/uploads/%s' % (request.folder, filename)) > return filename > except Exception, e: > return e > else: > return None

