Probelem about image size and dimensions

gongcheng_g at hotmail.com gongcheng_g at hotmail.com
Thu Mar 23 11:16:40 CET 2006


I got a piece of python script to upload file and it can upload it to
different folders on server depend on the type of file is image or not.
but I also want to restrict the size and dimensions of file if it is a
image file.Could anyone help me out?


Parameter List:id, file, title='',folder

REQUEST=context.REQUEST
content_type=file.headers['Content-Type']
if content_type.find('image')!=-1: #.find() is a method in Python2.0<


destination=context.restrictedTraverse('/cheng/rvdpas/uploadImage/'+folder)
    destination.manage_addImage(id, file, title)\


else:

destination=context.restrictedTraverse('/cheng/rvdpas/uploadDocument/'+folder)
    destination.manage_addFile(id, file, title)
    

return 'Finished'




More information about the Python-list mailing list