Changeset 428
- Timestamp:
- 07/28/06 07:46:18 (4 years ago)
- Location:
- qPloneCaptchas/trunk
- Files:
-
- 2 modified
-
skins/plone_captchas/getCaptchaImage.py (modified) (1 diff)
-
utils.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
qPloneCaptchas/trunk/skins/plone_captchas/getCaptchaImage.py
r419 r428 13 13 index = int(float(date) % length) 14 14 15 im = gen_captcha(getWord(index), 50)15 im = gen_captcha(getWord(index), 27) 16 16 context.REQUEST.RESPONSE.setHeader('Content-Type', 'image/jpeg') 17 17 context.REQUEST.RESPONSE.setHeader('Content-Length', im['size']) -
qPloneCaptchas/trunk/utils.py
r419 r428 1 import os 1 2 import md5 2 3 import random … … 39 40 outFile = StringIO() 40 41 41 font = ImageFont.load_default() 42 dim = font.getsize(text) 43 im = Image.new('RGB', (dim[0]+5,dim[1]+5), 0xffffff) 44 draw = ImageDraw.Draw(im) 45 draw.textsize(text) 46 draw.text((3,3), text, font=font, fill=0x0b) 47 """ 42 DATA_PATH = os.path.abspath(os.path.dirname(__file__)) + '/data' 43 FONT_PATH = DATA_PATH + '/fonts' 44 48 45 # randomly select the foreground color 49 46 fgcolor = random.randint(0,0xffff00) … … 52 49 # create a font object 53 50 import sys 54 #font = ImageFont.truetype('data/fonts/vera/Vera.ttf',fnt_sz) 55 font = ImageFont.load_default() 51 font = ImageFont.truetype(FONT_PATH+'/vera/Vera.ttf', fnt_sz) 56 52 # determine dimensions of the text 57 53 dim = font.getsize(text) … … 67 63 d.text((3,3), text, font=font, fill=fgcolor) 68 64 im = im.filter(ImageFilter.EDGE_ENHANCE_MORE) 69 """ 65 70 66 # save the image to a file 71 67 im.save(outFile, format=fmt)
![(please configure the [header_logo] section in trac.ini)](/products/chrome/common/qtrac_logo.png)