Posted on 2009-09-06 06:58:15-07 by netticat
It works but would need one more option at least
I decided to use GD::SecurityImage::AC instead of coding a captcha handler. However, there was a problem, I think it is related to SecurityImage itself. I tried some TTF fonts and with many of them the letters were placed vertically outside of the captcha image or were only partially visible. I know that this is a matter of font size and that the issue could be compensated by enlarging the captcha size. I tried both but a smaller font size was very hard to read and enlarging the captcha really produced too big images. I would appreciate if there was an option to define the letter spacings or something like that. I tried to fix it myself, but since my Perl knowledge is very limited, I might have done something stupid(?) Nevertheless, it now seems to work. Here my modification in GD.pm: # push(@randomy, $_, - $_) foreach $sy*1.2,$sy, $sy/2, $sy/4, $sy/8; push(@randomy, $_, - $_) foreach $sy/3,$sy/4, $sy/5, $sy/6, $sy/8; #modificated BTW, I also added some more randomness to angles, particles and to circles/ellipses. I think it shouldn't be so fixed as currently done by SecurityImage, just for security reasons. (to see modifications go to http://netticat.ath.cx ... Contact/Message) One more question: What would I need to do to get letters slightly overlapping each other?
Direct Responses: 11406 | Write a response
Posted on 2009-09-08 00:03:08-07 by burak in response to 11401
Re: It works but would need one more option at least
You need to change the image dimensions as stated in the docs. Not sure the point size you're using but 40 is suitable for most I guess. For example this image is 420x100: http://img505.imageshack.us/img505/347/burakrw7.gif as for the overlapping; I see that you're using the scramble option. It adds three spaces between the characters to prevent overlapping. If you remove them captcha will not be readable. Btw, any modifications you made by hand to the module internals will break if you ever upgrade or move to another machine. So, you need to maintain that updates or never upgrade the module if there is a new version. Sorry I can't help with these issues...
Direct Responses: 11410 | Write a response
Posted on 2009-09-08 10:00:34-07 by netticat in response to 11406
Re: It works but would need one more option at least
I am using a point-size of 50 and I would need to make the image quite large so that it works in every case. That's why I preferred my code modification. Also I would like to use scrambling together with overlapping characters but I see that this currently is not possible. I am aware of the fact that I need to maintain my modifications if I make an update. That's why I documented the changes well. However, to be honest, I still hope that you find some of my modifications worth to be integrated in a future update of GD::SecurityImage so that I do not need to apply the modifications again.
Direct Responses: 11426 | Write a response
Posted on 2009-09-10 07:49:17-07 by burak in response to 11410
Re: It works but would need one more option at least
I don't think a little big image makes any problem since we're not talking about the size of picture here. And overlapping the characters is not that simple :) I need to re-implement that part and your suggestion is not quite a patch. Here is how GD works: When you draw a char, it is surrounded by a box and you need to *somehow* calculate the borders of each box to make them overlap a little but not much to prevent generating unreadable images. It currently adds spaces between the characters instead. So, it needs a new algorithm to calculate the necessary parts and frankly, I don't have time for this and I can't promise anything.
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.