pbreit,

I just used your script and my first time thumbnails are working again. 
However the are still not computing on update. Do your thumbnails compute 
when updating?

Brandon

On Wednesday, June 20, 2012 1:58:12 PM UTC-6, pbreit wrote:
>
> Mine seems to work OK with current trunk:
>
> db.item.image_thumb.compute = lambda r: resize_image(r['image'], 
> (150,130), 'thumb')
>
> 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
>

Reply via email to