0

I have a PHP script that generates a PNG captcha(set by Content-Type header).It can be embedded in an HTML page by just using img. I want to convert that image to base64 format for displaying.How do I go about doing that ?

Using the normal method for encoding as given on Wikipedia's article(Click Here) doesn't work.

2
Contributors
1
Reply
23
Views
3 Years
Discussion Span
Last Post by LastMitch
0

I have a PHP script that generates a PNG captcha(set by Content-Type header).It

I haven't done this before but you can try this.

Have you try to put the data on an xml element?

<?php
$img = file_get_contents('captcha.png');
$imgdata = base64_encode($img);  
?>

Then your xml tags should be like this:

<image width="25" height="25">data:image/png;base64,imageData</image>

or you can take a look at this:

http://shashankbhide.wordpress.com/2011/11/15/base64-encoded-image-based-captcha-control/

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.