ojengwa / django-simple-captcha

Automatically exported from code.google.com/p/django-simple-captcha
MIT License
1 stars 0 forks source link

Image.rotate parameter expand not compatible with some PIL versions #14

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Problem: Forms with captcha fields do not display the image.

Behavior: Image tag and URL are included in the pape, but the captcha image
does not load. Attempting to load the image's URL in the browser provokes
debug error that states "rotate received unexpected parameter expand".

Cause:  Version of PIL (1.1.5, Red Hat Enterprise Linux 5) does not include
the parameter expand.

Versions:  RHEL5, Django 1.1, PIL 1.1.5
# The Python Imaging Library.
# $Id: Image.py 2337 2005-03-25 07:50:30Z fredrik $

Fix: edit line 27 of views.py to remove 'expand=0' parameter:
charimage = charimage.rotate(random.randrange(
*settings.CAPTCHA_LETTER_ROTATION ), resample=Image.BICUBIC)

Suggestion: Remove?  

Code for Image.py in PIL 1.1.6 says the expand parameter is optional, and
ignored when absent:
    # @param expand Optional expansion flag.  If true, expands the output
    #    image to make it large enough to hold the entire rotated image.
    #    If false or omitted, make the output image the same size as the
    #    input image.

Original issue reported on code.google.com by j...@northwestern.edu on 17 Aug 2009 at 7:59

GoogleCodeExporter commented 9 years ago
Thank you for the precise report. 
This is fixed as of r35.

Original comment by mbonetti on 17 Aug 2009 at 8:50