I believe I did a good improvement to this recipe, in my version there is no need to call the HandleCaptchaImage handler anymore, that means we have just one call for each edit to the server.
Please take a look and tell me if anything goes wrong . Thank you. CarlosAB January 13, 2017, at 09:50 PM
You output the picture embedded in the HTML as a data URI. This will work in most modern browsers, and in MSIE 8 and later. Also the total bytes content of the embedded picture is increased by 33% although the browser not making a second call will save many bytes from the headers. I think this can be included in the recipe as a switch. --Petko January 14, 2017, at 12:04 AM
That is exactly how and what I did. Also, this won't generate any extra data for analysis by any web traffic/data gathering/analytics or any other software that captures access to the site using PmWiki, and then you can save a few more bytes. I completely changed the script, I'll try to add as a option to it and send back the resulting script. CarlosAB January 14, 2017, at 02:33 AM
Here is the third version with the option "EnableEmbeddedCaptcha".
It works for me if it doesn't for you, please tell me. CarlosAB January 14, 2017, at 12:18 PM
Sorry I totally forgot this when I released a new version. I'll release a new version with this feature, only the variable will be called $EnableCaptchaImageDataURI, and a new variable $CaptchaImageEmbedFmt will be added. Additionally, I prefer not to change/rename existing functions in case someone calls them directly. --Petko June 19, 2017, at 09:43 AM
Ok, no problem, I agree with you. CarlosAB June 19, 2017, at 07:28 PM
Support of Previewing
Smc Jan 12 2007 - Just tried this and have the following observations which IMHO would make this recipe very useful. Captcha does not support the 'Preview'ing a page without entering in a code. Once you do that, the code changes, so authors need to keep entering new codes every time they Preview. Recommend excluding page preview from Captcha check.
Support for beta65
Feb 22, 2008 - Beta65 doesn't seem to be working with captcha in the edit form. I did the same thing to implement it, using the Site.EditForm. But while it worked in earlier versions, now the captcha code doesn't appear in the edit form under the text area.
DaveG 17-Jul-2009: Captcha appears to work in the recent versions of PmWiki. Let us know if you still have problems.
Entered code is always wrong
Peter Kay Nov 11, 2009: I was surprised to find that cookies were required for the captcha to work. Moreover, the page must be loaded while cookies are enabled. Don't know if that helps.
Does not work for me in pmwiki2.2.2
'''JJ? 07/30/09:I install everything as instructed, add the markup to Site.EditForm, preview Site.EditForm and the Enter value: line shows up with a captcha code generated. I save the Site.Editform, and the Enter value line never again shows up when I edit anything. A red message reading "must enter valid code" is displayed, and now, unless I disable captcha in my config.php, I can never edit anything again because i am unable to enter a captcha code...so basically it will not work for me. I am using fixflow skin.
And just what is necessary on a server for the colored images to work?
Mark? 31st July 2008, 09:34 PM: [UK] Tried this cookbook a couple of times however there seems to be an issue I copied the code written on this page but for some reason no numbers appear. I tried this code previously and I think it may of worked once.
The Weird thing is if I use preview I get to see the numbers. I am using the triad skin.
How to make it work only on some pages...
I'm thinking of
$EnablePostCaptchaRequired = 1; valid only for pages where an
(:input captcha :) could be found. So if you want to have it on edit pages you can simply add it to the EditForm template (currently you have to do this anyways, if you have
$EnablePostCaptchaRequired = 1; set in general, with not other conditions). Any ideas how to achieve this? Is there a way to check whether
(:input captcha :) is somewhere within the source of the page??? Klonk March 07, 2010, at 10:48 AM
Not working in 2.2.4
This is recipe is great. However, I meet a problem to show image.
The browser complains: "The image cannot be displayed because it contains error.".
My PHP is able to output text to image, because the following code is running OK.
<?php header("Content-type: image/png"); $im = @imagecreatetruecolor(500, 90) or die("Cannot Initialize new GD image stream"); $text_color = imagecolorallocate($im, 233, 104, 191); imagestring($im, 5, 5, 5, "A Simple Text String, Oh yeah!", $text_color); imagepng($im); imagedestroy($im); ?>
This is the output.
I cannot figure out the problem of this recipe, but an image for CAPTCHA is essential. Anyone could help?
Thanks, Chandler (toliuch (at) gmail)