NYCPHP Meetup

[nycphp-talk] PEAR CAPTCHA Problems

Ben Sgro (ProjectSkyLine) ben at projectskyline.com
Wed Aug 29 23:07:31 EDT 2007


Hello Mike,

I did a print_r() on the object to see, and the path is correct.
I also did a chmod 777 on the arial.ttf file, plus tried to chown it as well
to apache. Nothing seems to work.

Here is the PEAR code where its failing:

      $this->_imt = new Image_Text(
            $this->_phrase,
            $options
        );

 if (PEAR::isError($this->_imt->init())) {
            $this->_error = PEAR::raiseError('Error initializing Image_Text 
(fo\
nt missing?!)');
            return $this->_error;

So, I hacked up the PEAR code to
 if (!PEAR::isError($this->_imt->init())) {

continue in case of an error, and it is generating the colored textbox image 
w/lines and circles
drawn on it, just no text.

Hmmm...

- Ben

Hello Ben,

All the captcha scripts that I have worked with either use an explicit
path to the specific font or the font has been in the same folder as
the script that calls it. In your example, the font would need to be
in the same folder as the script that sets up the options array, I
think.

HTH,


Ben Sgro, President
ProjectSkyLine - Defining New Horizons
+1 718.487.9368 (N.Y. Office)

Our company: www.projectskyline.com
Our products: www.project-contact.com

This e-mail is confidential information intended only for the use of the 
individual to whom it is addressed.
----- Original Message ----- 
From: <mikesz at qualityadvantages.com>
To: "NYPHP Talk" <talk at lists.nyphp.org>
Sent: Wednesday, August 29, 2007 10:13 PM
Subject: Re[2]: [nycphp-talk] PEAR CAPTCHA Problems


> Hello Ben,
>
> Thursday, August 30, 2007, 9:39:20 AM, you wrote:
>
>> Hello,
>
>> I did just as you stated. No luck.
>
>> I grabbed the file from windows and mac (.ttf) checked the path, tried a 
>> few
>> variations, and made sure the $options array had the values set before
>> passing to the function.
>
>> I want to say its a path issue, but I've tried both relative and absolute
>> paths.
>
>> Any ideas?
>
>> - Ben
>
>> Ben Sgro, President
>> ProjectSkyLine - Defining New Horizons
>> +1 718.487.9368 (N.Y. Office)
>
>> Our company: www.projectskyline.com
>> Our products: www.project-contact.com
>
>> This e-mail is confidential information intended only for the use of the
>> individual to whom it is addressed.
>> ----- Original Message ----- 
>> From: "Gary Mort" <bz-gmort at beezifies.com>
>> To: "NYPHP Talk" <talk at lists.nyphp.org>
>> Sent: Wednesday, August 29, 2007 7:43 PM
>> Subject: Re: [nycphp-talk] PEAR CAPTCHA Problems
>
>
>>> Find a ttf file, any ttf file(if your using windows, take a look in your
>>> control panel->fonts folder
>>>
>>> Upload it to the server and put it somewhere readable by your web 
>>> program.
>>>
>>> Set the options appropriately, ie:
>>>
>>> |// Set CAPTCHA options (font must exist!)
>>> $options = array(
>>>    'font_size' => 24,
>>>    'font_path' => './',
>>>    'font_file' => 'COUR.TTF'
>>> );
>>>
>>> Where font_path is the full path to your font file
>>> and font_file is your font file(make sure case matches!)
>>>
>>> Make sure to pass your options to the functions that require them.
>>>
>>>
>>> A little prayer couldn't hurt. :-)
>>>
>>> (Captcha images are a royal PITA due to the font issues, ability to 
>>> write
>>> to the correct directory, and whether or not you have GD or freetype or
>>> ImageMagick or whatever they want installed)
>>>
>>>
>>>
>>> |
>>>
>>>
>>> _______________________________________________
>>> New York PHP Community Talk Mailing List
>>> http://lists.nyphp.org/mailman/listinfo/talk
>>>
>>> NYPHPCon 2006 Presentations Online
>>> http://www.nyphpcon.com
>>>
>>> Show Your Participation in New York PHP
>>> http://www.nyphp.org/show_participation.php
>
>> _______________________________________________
>> New York PHP Community Talk Mailing List
>> http://lists.nyphp.org/mailman/listinfo/talk
>
>> NYPHPCon 2006 Presentations Online
>> http://www.nyphpcon.com
>
>> Show Your Participation in New York PHP
>> http://www.nyphp.org/show_participation.php
>
>> __________ NOD32 2491 (20070830) Information __________
>
>> This message was checked by NOD32 antivirus system.
>> http://www.eset.com
>
>
> Hello Ben,
>
> All the captcha scripts that I have worked with either use an explicit
> path to the specific font or the font has been in the same folder as
> the script that calls it. In your example, the font would need to be
> in the same folder as the script that sets up the options array, I
> think.
>
> HTH,
>
> -- 
> Best regards,
> mikesz                            mailto:mikesz at qualityadvantages.com
>
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php 




More information about the talk mailing list