Hi, i’m trying to read images from a existing sqlite db. For some reason when i save the images to disk, they are corrupted.
cherry_db = DAL('sqlite://{}'.format(form.vars.cherry_file), folder=upload_folder, migrate=False)
cherry_db.define_table('image',
Field('node_id', 'integer', requires=IS_NOT_EMPTY()),
Field('png', 'blob')
)
images = cherry_db(cherry_db.image.node_id == i['node_id']).select(cherry_db.image.node_id, cherry_db.image.png)
for m in images:
name = str(uuid.uuid4())
print('image {}'.format(name))
print(m['png'])
im = open('{}'.format(session.project_folder+'/'+name+'.png'), 'wb')
im.write(m['png'])
im.close()
Cheers.
Chris.