--- Begin Message ---def image(): if len(request.args) == 1: #nothing to change, just give the full image return response.download(request, db) else: import Image import os image_file = request.args[0] image_file = os.path.join(request.folder, "uploads", image_file) width = int(request.args[1]) height = int(request.args[2]) image_file=Image.open(image_file) w = int(image_file.size[0]) h = int(image_file.size[1]) if width==0 and height!=0: w=height*w/h h=height elif height==0 and width!=0: h=width*h/w w=width else: w=width h=height resized_image = image_file.resize((w,h),Image.ANTIALIAS) response.headers['Content-Type']="image/png" resized_image.save(response.body, "PNG") return response.body.getvalue() I found an old post by Dr. M and that showed me the rest of the issue. This should be in the book as it comes in handy. :D I know PIL is not in W2P but it would be nice to see some examples for those that can use it. --- Best Regards and thank you, Jason Brower--- Begin Message ---Right now when I try to use it it tells me a number is required... Huh? And if I statically set w and h it doesn't download the iamges. What am I missing here to make this work? --- def image(): if len(request.args) == 1: #nothing to change, just give the full image return response.download(request, db) else: import Image import os image_file = request.args[0] image_file = os.path.join(request.folder, "uploads", image_file) width = request.args[1] height = request.args[2] image_file=Image.open(image_file) w = image_file.size[0] h = image_file.size[1] if width==0 and height!=0: w=height*w/h h=height elif height==0 and width!=0: h=width*h/w w=width else: w=width h=height resized_image = image_file.resize((w,h),Image.ANTIALIAS) return resized_image --- Best Regards, Jason Brower
--- End Message ---
--- End Message ---

