Django Simple Captcha Image Size
How can I change captcha image size and text padding in image? I read official docs and havn't found any of those.
Solution 1:
I have never used this app, but I've found in code something:
#captcha/views.pydefcaptcha_image(request, key, scale=1):
#function goes here
So if you call captch_image with additional paramater scale
, you can change the size.
If you use urls for this app like
urlpatterns = patterns('captcha.views',
url(r'image/(?P<key>\w+)/$', 'captcha_image', name='captcha-image', kwargs={'scale': 1}),
You can change scale
parameter right in the line.
If you want to change proportions of dimensions, I think it is not supported, because
#captcha/views.captcha_image
...
size = font.getsize(text)
size = (size[0] * 2, int(size[1] * 1.2))
...
They are hardcoded in the function captcha_image
. But you can replace the font.
Solution 2:
take a look at https://github.com/mbi/django-simple-captcha/blob/master/captcha/views.py
There are two variables CAPTCHA_IMAGE_SIZE
as well as CAPTCHA_FONT_SIZE
Just put into your settings.py e.g.
CAPTCHA_IMAGE_SIZE=[200,200]
CAPTCHA_FONT_SIZE=30
and you're fine
Solution 3:
Maybe it would be an option to resize the captcha in your css (e.g. setting width/heigth to 150%)
Post a Comment for "Django Simple Captcha Image Size"