diff --git a/thirdpart/captcha/conf/settings.py b/thirdpart/captcha/conf/settings.py index e344bd9107..a57684b1f0 100644 --- a/thirdpart/captcha/conf/settings.py +++ b/thirdpart/captcha/conf/settings.py @@ -1,6 +1,7 @@ import os from django.conf import settings +CAPTCHA_IMAGE_SIZE = getattr(settings, 'CAPTCHA_IMAGE_SIZE', (90,42)) CAPTCHA_FONT_PATH = getattr(settings, 'CAPTCHA_FONT_PATH', os.path.normpath(os.path.join(os.path.dirname(__file__), '..', 'fonts/Vera.ttf'))) CAPTCHA_FONT_SIZE = getattr(settings, 'CAPTCHA_FONT_SIZE', 22) CAPTCHA_LETTER_ROTATION = getattr(settings, 'CAPTCHA_LETTER_ROTATION', (-35, 35)) diff --git a/thirdpart/captcha/views.py b/thirdpart/captcha/views.py index 3b096f2d4a..bb9443293b 100644 --- a/thirdpart/captcha/views.py +++ b/thirdpart/captcha/views.py @@ -92,6 +92,7 @@ def captcha_image(request, key, scale=1): for f in settings.filter_functions(): image = f(image) + image = image.resize(settings.CAPTCHA_IMAGE_SIZE, Image.ANTIALIAS) out = StringIO() image.save(out, "PNG") out.seek(0)