Member
Member
meek   2006-08-07, 13:57
#1

Hi.

I'm using the ZenPhoto Captcha Hack from the ZenPhoto Wiki: http://www.zenphoto.org:8080/confluence/display/PLUG/Home It works fine as it is but I would like to add one or two more letters in the captcha image. I suppose it's in the generate_code.php file. Does anybody know how?

  • Meek
Member
Member
meek   2006-08-07, 13:59
#2

Woops, I guess I should have posted this in the 'Comments' category... Could someone move this, please? Thanks.

Member
Member
dilligaf   2007-03-25, 23:30
#3

I found a way to do this and made some changes to the code to make the captcha a little more random.

1 - I added the numbers to the alphabet and deleted the number string line 3

$lettre='abcdefghijklmnpqrstuvwxyz123456789';

2 - This is the first part to make your captcha larger. Add as many rand strings as you want. I have six so my captcha image will be six digits long. (Since I added to the number string on line 3 there are now 34 digits, hence the 0 to 33)

`$rand1=rand(0,33);

$rand2=rand(0,33);

$rand3=rand(0,33);

$rand4=rand(0,33);

$rand5=rand(0,33);

$rand6=rand(0,33);`

3 - Now to get the letter/number for each digit in the captcha. Again there are six as my captcha is six digits long.

`$lettre1=$lettre[$rand1];

$lettre2=$lettre[$rand2];

$lettre3=$lettre[$rand3];

$lettre4=$lettre[$rand4];

$lettre5=$lettre[$rand5];

$lettre6=$lettre[$rand6];

`
4 - Now you have to add all these variable to line 15 (or around there).

$code=md5($lettre1.$lettre2.$lettre3.$lettre4.$lettre5.$lettre6);

5 - next you have to change the number 65 to match the size of your captcha.
I use this formula:
Start with 5 and add 15 for every digit in your captcha.
a five digit captcha would be 80, six digits 90, seven digits 105 etc.
Whatever it is remember that number(We will use six digits in our example so our number is 95).
So this line

`//header ("Content-type: image/png");

$image = imagecreate([b]65[/b],20);`

becomes

`//header ("Content-type: image/png");

$image = imagecreate([b]95[/b],20);`

6 - Next this line has to change from

`$fond = imagecolorallocate($image, 255, 255, 255);

ImageFill ($image,[b]65[/b],20, $fond);`

to our number from 5

`$fond = imagecolorallocate($image, 255, 255, 255);

ImageFill ($image,[b]95[/b],20, $fond);`

7 - this line changes

`{

ImageLine($image, 0,$i, [b]65[/b],$i, $ligne);

$i = $i+7;

}`

to our number from 5

`{

ImageLine($image, 0,$i, [b]95[/b],$i, $ligne);

$i = $i+7;

}`

8 - and this changes

`$i = 10;

while($i

Member
Member
dilligaf   2007-04-04, 19:13
#4

Ooops just noticed I made an adding mistake in 5

5 - next you have to change the number 65 to match the size of your captcha.
I use this formula:
Start with 5 and add 15 for every digit in your captcha.
a five digit captcha would be 80, six digits 95, seven digits 110 etc.
Whatever it is remember that number(We will use six digits in our example so our number is 95).

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.