summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nitzo <nitzo2001@yahoo.com> 2016-03-01 02:46:38 +0100
committerGravatar Nitzo <nitzo2001@yahoo.com> 2016-03-01 02:46:38 +0100
commit94c002da9e4dc9743c41c2bf0af03533ae4c1c50 (patch)
tree444f7a57e1b2a11ddacf92f096d25f976a343776
parent[ReCaptcha] Update (diff)
downloadpyload-94c002da9e4dc9743c41c2bf0af03533ae4c1c50.tar.xz
[ReCaptcha] Code cosmetics
-rw-r--r--module/plugins/captcha/ReCaptcha.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/module/plugins/captcha/ReCaptcha.py b/module/plugins/captcha/ReCaptcha.py
index 071f7f8b0..259b80606 100644
--- a/module/plugins/captcha/ReCaptcha.py
+++ b/module/plugins/captcha/ReCaptcha.py
@@ -29,7 +29,7 @@ except ImportError:
class ReCaptcha(CaptchaService):
__name__ = 'ReCaptcha'
__type__ = 'captcha'
- __version__ = '0.26'
+ __version__ = '0.27'
__status__ = 'testing'
__description__ = 'ReCaptcha captcha service plugin'
@@ -136,14 +136,15 @@ class ReCaptcha(CaptchaService):
# points in a text font (see typography) and thus we can hereby calculate
# the biggest text height of a given font
- font_name = 'arialbd'
s = StringIO()
s.write(image)
s.seek(0)
-
+
img = Image.open(s)
draw = ImageDraw.Draw(img)
+ font_name = 'arialbd'
+
if os.name == 'nt':
font = ImageFont.truetype(font_name, 13)
else:
@@ -159,6 +160,7 @@ class ReCaptcha(CaptchaService):
'x': x * tile_size['width'] + (tile_size['width'] / 2) - (tile_index_size['width'] / 2),
'y': y * tile_size['height']
}
+
draw.rectangle(
[
tile_index_pos['x'] - margin,
@@ -168,8 +170,10 @@ class ReCaptcha(CaptchaService):
],
fill='white'
)
+
index_number = str(y * 3 + x + 1)
text_width, text_height = draw.textsize(index_number, font=font)
+
draw.text(
(
tile_index_pos['x'] + (tile_index_size['width'] / 2) - (text_width / 2),