Re: Captcha using TTF & GD
Andrew-
Regards to upgrading from v1.33 to 1.34 it looks like the only file needing updating was the classes file, so that's what I did.
Same issues continue. CAPTCHA image does not display on the shop running on PHP5.
Error log entry shows:
Code:
File does not exist: /home/ergo/public_html/403.shtml
client denied by server configuration: /home/account/public_html/shop/includes/templates/my_template/images/index.php
And I tried out your new _test_captcha.php with same negative result.
I do see IMAGE_CAPTCHA _ALT displays where the CAPTCHA image should be. I'm assuming this a new define that needs to go into the language file?
Below is the generated source from the contact_us page:
Code:
<img id="captimg" src="http://www.domain.com/shop/captcha_img.php?0.588261001174405752" alt="IMAGE_CAPTCHA_ALT" title=" IMAGE_CAPTCHA_ALT " height="50" width="240">
<input src="includes/templates/my_template/buttons/english/button_redraw.gif" alt="Redraw Capture Image" title=" Redraw Capture Image " onclick="document.getElementById('captimg').src='http://www.domain.com/shop/captcha_img.php?'+Math.random();return false;" type="image">
<br class="clearBoth">
<label for="captcha">Verification code:</label>
<input name="captcha" id="captcha" type="text"> <span class="alert">* (case insensitive)</span>
<br class="clearBoth">
All of the above is for the shop running on PHP5.
I updated to v1.34 CAPTCHA on the server running PHP4 and the CAPTCHA image still displays. But font size remains tiny. Changing values for 'Chars minimum size' and 'Chars maximum size 'has no effect.
I am not understanding the meaning of "(1.0=Image Height)". Is that reference to pixel size or relative aspect ratio or some percentage of something?
Besides the default values I tried 24.0 and 36.0 respectively.
Is there anything I can tell my hosting provider what to look for regards he support required for this CAPTCHA mod.
I'm thinking possibly some server security configuration is disallowing the 0.588261001174405752 parameter appended to http://www.domain.com/shop/captcha_img.php?
<img src="http://www.domain.com/shop/captcha_img.php?0.588261001174405752">
Appreciate your advice and assistance in trying out different ideas.
Woody
Re: Captcha using TTF & GD
Quote:
Originally Posted by
Woodymon
I do see IMAGE_CAPTCHA _ALT displays where the CAPTCHA image should be. I'm assuming this a new define that needs to go into the language file?
Sorry, forgotten. Fixed.
Re: Captcha using TTF & GD
Quote:
Originally Posted by
Woodymon
I updated to v1.34 CAPTCHA on the server running PHP4 and the CAPTCHA image still displays. But font size remains tiny. Changing values for 'Chars minimum size' and 'Chars maximum size 'has no effect.
Similar that there are no fonts found.
Quote:
Originally Posted by
Woodymon
I am not understanding the meaning of "(1.0=Image Height)". Is that reference to pixel size or relative aspect ratio or some percentage of something?
Yes its a ratio. 1 corresponds to height of the image. 0.9 - 0.9 from height, 0.8 - 0.8 heights etc.
Re: Captcha using TTF & GD
Quote:
Originally Posted by
a_berezin
Similar that there are no fonts found.
Thanks for that tip. And indeed after deleted the only TTF in the fonts directory the CAPTCHA image still displays with the six characters still at the same size. So knowing this will assist me in focusing my troubelshooting.
Quote:
Originally Posted by
a_berezin
Yes its a ratio. 1 corresponds to height of the image. 0.9 - 0.9 from height, 0.8 - 0.8 heights etc.
Ahhh... now I understand. 0.9 means the characters will display at 90% of the pixel height of the CAPTCHA image. Thanks for the clarification.
And FYI, I just submitted a follow-up message to my webhost regarding issue of the CAPTCHA image not displaying properly. I'm quite convinced now that some filtering rule(s) are in place causing the image to not display. I recall a similar error message a month ago or so when my shops product images generated by Image Handler 2 mysteriously quit displaying. After hemming and hawing over thias issue for two days the web host tech finally recalled they began "experimenting" with filtering on files ending with x80 (to protect against some infiltration technique tha's going around). Well if you have Image Handler 2 installed and you configure your small product images to display at 150wx80h size the filename will be appended with 150x80. Thus the webhost filtering rules put a stop to my product images for several days until they could figure out (remember) what they did to cause the issue. Doh! Document your changes boys and girls!! Needless to say they lost some credibility points on that one.
Woody
Re: Captcha using TTF & GD
Quote:
Originally Posted by
a_berezin
Similar that there are no fonts found.
Quote:
Originally Posted by woodymon
And indeed after deleted the only TTF in the fonts directory the CAPTCHA image still displays with the six characters still at the same size. .
Further testing shows the characters in the CAPTCHA image disappear after the verdana.TTF font is deleted AND when the three previously provided fonts (captcha_0.ttf...) are uploaded to the /fonts directory.
So that indicates the script is ndeed "seeing" the /fonts directory.
Wondering why the CAPTCHA characters don't display when the old fonts are installed but with no fonts installed, generic characters display.
Something is funky with this picture :wink2:
Woody
Re: Captcha using TTF & GD
Just delete the "glob" thing from _getFileList it finally works on my server.
PHP Code:
function _getFileList($directory, $file_ext) {
$file_list = array();
if ($za_dir = @dir(rtrim($directory, '/')))
{
while ($filename = $za_dir->read()) {
if (preg_match('/\.' . $file_ext . '$/i', $filename) > 0)
{
$file_list[] = $directory . $filename;
}
}
sort($file_list);
}
return $file_list;
}
Quote:
Originally Posted by
Woodymon
Further testing shows the characters in the CAPTCHA image disappear after the verdana.TTF font is deleted AND when the three previously provided fonts (captcha_0.ttf...) are uploaded to the /fonts directory.
So that indicates the script is ndeed "seeing" the /fonts directory.
Wondering why the CAPTCHA characters don't display when the old fonts are installed but with no fonts installed, generic characters display.
Something is funky with this picture :wink2:
Woody
Re: Captcha using TTF & GD
Quote:
Originally Posted by
babygekko
Just delete the "glob" thing from _getFileList it finally works on my server.
What a problem with "glob" function? It's exist but don't work?
Re: Captcha using TTF & GD
Yes, the glob function didn't work on my server (shared hosting, PHP4). I also had to delete the ob_start() and ob_end_clean() from captcha_img.php. Things work out perfectly right after that.
Quote:
Originally Posted by
a_berezin
What a problem with "glob" function? It's exist but don't work?
Re: Captcha using TTF & GD
Exist but didn't work.. Very strange. And what your hoster talk about this?
What a problem with ob_* functions in captcha_img.php? They prevent any output in application_top.php.
Re: Captcha using TTF & GD
I just tried it on my other machine - WinXP with EasyPHP 1.8 (Apache 1.3.33 - PHP 4.3.10 - MySql 4.1.9) and same thing. On the XP/EasyPHP machine, I had to remove ob_start and ob_end_clean from showCaptchaImg before it could work. After that captcha shows fine on my XP.
I suppose it does exist because PHP > version 4.3
It's ok - I just had to remove those and it's looking good. My feedback: maybe you can find better color for the fonts? The colors just look ... you know .. :yuck: yucky... hehehe
Quote:
Originally Posted by
a_berezin
Exist but didn't work.. Very strange. And what your hoster talk about this?
What a problem with ob_* functions in captcha_img.php? They prevent any output in application_top.php.