PHP Classes

A little change

Recommend this page to a friend!

      Captcha Numbers V2.1  >  All threads  >  A little change  >  (Un) Subscribe thread alerts  
Subject:A little change
Summary:a patch to make this class work without TrueType functions
Messages:2
Author:sinasalek
Date:2006-06-29 16:29:36
 

  1. A little change   Reply   Report abuse  
Picture of sinasalek sinasalek - 2006-06-29 16:29:36
Hi, at first i must thank you for your useful class.
as you know some server doesn't Compiled GD with TrueType, so i changed your code a bit to make it word in this kind of situation.
Best Regards - Sina Salek
-----------------------------------------------------

if ($i%2) ImageTTFText($image, $this -> size, $this -> angle, $x, $this -> size + $this -> grid - mt_rand(0, 5), $stringcolor_1, $this -> font, $str{$i} );
else ImageTTFText($image, $this -> size, $this -> angle, $x, $this -> size + $this -> grid + mt_rand(0, 5), $stringcolor_2, $this -> font, $str{$i} );

-----------changed to-----------

if (is_callable('imagettftext')) {
if ($i%2) ImageTTFText($image, $this -> size, $this -> angle, $x, $this -> size + $this -> grid - mt_rand(0, 5), $stringcolor_1, $this -> font, $str{$i} );
else ImageTTFText($image, $this -> size, $this -> angle, $x, $this -> size + $this -> grid + mt_rand(0, 5), $stringcolor_2, $this -> font, $str{$i} );
} else {
/* Edited By Sina : some server doesn't compile GD with TrueType so i added this lines to solve this problem*/
if ($i%2) imagechar($image, $this -> size, $x, $this -> grid - mt_rand(0, 5), $str{$i},$stringcolor_1 );
else imagechar($image, $this -> size, $x, $this -> grid + mt_rand(0, 5), $str{$i},$stringcolor_2 );
}

  2. Re: A little change   Reply   Report abuse  
Picture of Albert Demeter Albert Demeter - 2019-03-17 11:14:33 - In reply to message 1 from sinasalek
Thanks for your suggestion. I have implemented this change in the new version.