dchest / captcha

Go package captcha implements generation and verification of image and audio CAPTCHAs.
godoc.org/github.com/dchest/captcha
MIT License
1.92k stars 293 forks source link

add GetBase64Image API #19

Closed noahlam closed 6 years ago

noahlam commented 6 years ago

add GetBase64Image API for generate a captcha in base64 format add test case for GetBase64Image API add document for GetBase64Image API

dchest commented 6 years ago

Thanks, I agree that base64-encoded images are useful to include in the first request instead of loading the image in a separate request, however I think WriteImage or Image.WriteTo are already generic enough for that and it seems having a io.Writer that will convert PNG into data-URI would be a better approach. I mean specifically, not in captcha package, but as a separate package that can be applied more generally, rather than each package containing their own implementation.

noahlam commented 6 years ago

Ok, I respect your opinion, but I still feel that I should open a more direct API to the user. After all, not everyone is familiar with golang. The reason why I commit this pr is because I used captcha at early, and I tried a lot of methods, can not be converted image to base64 code.