Any success on getting the computed thumbnail image to autodelete? I'm 
having trouble with this too, where an update of a new thumbnail will not 
delete the old file.

On Saturday, April 28, 2012 5:06:25 PM UTC-7, ctrlSoft wrote:
>
>
> hi i have a resize function wich creates image thumbanils...
> def THUMB(image, nx=120, ny=120):
>     from PIL import Image 
>     import os  
>     try:
>         img = Image.open(request.folder + 'static/img_folder/' + image)
>         img.thumbnail((nx,ny), Image.ANTIALIAS) 
>         root,ext = os.path.splitext(image)
>         thumb='%s_thumb%s' %(root, ext)
>         img.save(request.folder + 'static/img_folder/' + thumb)
>         return thumb
>     except: 
>         return None  
>  
> and this :
> db.define_table("news",
>     Field('image', 'upload', requires=IS_EMPTY_OR(IS_IMAGE()), 
> uploadfolder=request.folder+'static/img_folder', autodelete=True), 
>     Field('image_thumb', 'upload', compute=lambda r: THUMB(r['image']), 
> autodelete=True), 
>     Field("title",label=T('Title'),requires=IS_NOT_EMPTY()),
>     Field("content" 
> ,type='text',label=T('Content'),requires=IS_NOT_EMPTY()))
>
> the problem is when i delete a row, image("big image") is deleteing from 
> disk but the image_thumb stil remains on disk. 
> any solutions are welcome :), thx
>
> ___
> Alex
>
>

-- 



Reply via email to