Changeset 1711 for WAeUP_SRP/trunk


Ignore:
Timestamp:
25 Apr 2007, 19:22:21 (17 years ago)
Author:
Henrik Bettermann
Message:

using PIL for passport conversion

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/Students.py

    r1710 r1711  
    2626
    2727import DateTime
    28 # import PIL.Image
     28import PIL.Image
    2929from StringIO import StringIO
    3030
     
    646646            picture ="%s/import/pictures/%s.jpg" % (i_home,jamb_reg_no)
    647647            app.manage_setLocalRoles(sid, ['Owner',])
     648           
    648649            picture_id = da['jamb_reg_no'].replace('/','_')
    649650            file = None
     
    654655                    break
    655656            if file is not None:
    656                 outfile = file.read()
     657                img = PIL.Image.open(file)
     658                img.thumbnail((150,200),
     659                              resample=PIL.Image.ANTIALIAS)
     660                # We now need a buffer to write to. It can't be the same
     661                # as the inbuffer as the PNG writer will write over itself.
     662                outfile = StringIO()
     663                img.save(outfile, format=img.format)           
     664                #outfile = file.read()
    657665                app_doc.manage_addFile('passport',
    658666                                       file=outfile,
Note: See TracChangeset for help on using the changeset viewer.