I have this: db.define_table('uploads', Field('name','string'), Field('fileit','upload'), Field('thumbnail','upload',), )
This is my onvalidate function: def WriteThumb(form): import StringIO i = StringIO.StringIO() o = StringIO.StringIO() i.write(form.vars.fileit.value) i.seek(0) im = Image.open(i, 'r') im.thumbnail((100,100),Image.ANTIALIAS) im.save(o,'JPEG') o.seek(0) form.vars.thumbnail = base64.b64encode(o.getvalue()) o.close() i.close() If I leave the input blank on Thumbnail I get this url saved: http://127.0.0.1:8000/testapp/default/download//9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL If I do use a filename, which will be overwritten by the new Thumbnail, I get this text url: http://127.0.0.1:8000/gaeupload/default/download/uploads.thumbnail.832b5cf1989b3feb.66696c652e747874.txt I tried StringIO and CStringIO, but no joy. How do I get my function to put data into Thumbnail so that it save properly in file system? Or, maybe someone would share a better way... Thanks, David -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@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.