Richard Munroe - 2005-11-04 14:43:02
Included is a patch to Captcha Numbers V2 to allow fonts (with paths) to be specified in the constructor. I needed this on a Debian Linux system to get to the Arial font which is provided by MicroSoft and installed in a sub-directory of /usr/share/fonts/truetype (which is where GD is looking for them).
Index: captcha_numbersV2.php
===================================================================
RCS file: /home/Repository/captcha/captcha_numbersV2.php,v
retrieving revision 1.1
retrieving revision 1.3
diff -c -4 -r1.1 -r1.3
*** captcha_numbersV2.php 4 Nov 2005 11:26:47 -0000 1.1
--- captcha_numbersV2.php 4 Nov 2005 14:31:38 -0000 1.3
***************
*** 1,5 ****
--- 1,13 ----
<?
+ /*
+ ** Edit History:
+ **
+ ** Dick Munroe (munroe@csworks.com) 04-Nov-2005
+ ** Add a font specifier to the constructor allowing
+ ** font paths to be specified.
+ */
+
/**
* CaptchaV2 File
* Generates CAPRCHA Numbers and Chars Image
* @author Albert Demeter <borex8@hotmail.com>
***************
*** 24,32 ****
/**
* CaptchaNumbersV2 Class
* @access public
* @author Albert Demeter <borex8@hotmail.com>
! * @version 2.0
*/
class CaptchaNumbersV2 {
var $length = 6;
--- 32,40 ----
/**
* CaptchaNumbersV2 Class
* @access public
* @author Albert Demeter <borex8@hotmail.com>
! * @version 2.0.1
*/
class CaptchaNumbersV2 {
var $length = 6;
***************
*** 43,56 ****
* @return void
* @param int $length string length
* @param int $size font size
* @param String $type image type
! * @param String $captchaType text contain digits, chars or mixed
* @desc generate the main image
*/
! function CaptchaNumbersV2($length = '', $size = '', $type = '', $captchaType = '') {
! if ($length!='') $this -> length = $length;
if ($size!='') $this -> size = $size;
if ($type!='') $this -> type = $type;
if ($captchaType!='') $this -> captchaType = $captchaType;
--- 51,66 ----
* @return void
* @param int $length string length
* @param int $size font size
* @param String $type image type
! * @param String $captchaType text contain digits, chars or mixed
! * @param String $font the font and optionally path to be used.
* @desc generate the main image
*/
! function CaptchaNumbersV2($length = '', $size = '', $type = '', $captchaType = '', $font = '') {
! if ($length!='') $this -> length = $length;
! if ($font!='') $this -> font = $font ;
if ($size!='') $this -> size = $size;
if ($type!='') $this -> type = $type;
if ($captchaType!='') $this -> captchaType = $captchaType;
Thanks for the effort to produce this class.
Dick Munroe