Probelem about image size and dimensions

dwelch donald.welch at hp.com
Thu Mar 23 12:13:53 EST 2006


gongcheng_g at hotmail.com wrote:
> 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'
> 

You could try this to get the image dimensions:


http://www.python.org/pypi?%3Aaction=search&name=ImageSize&version=&summary=&description=&keywords=&_pypi_hidden=0

-Don



More information about the Python-list mailing list