preface

Image verification code is a very common functional requirements in the development process, used to do some anti-brush interface is very convenient, complex points will even use sliding jigsaw such a third-party verification code service.

Of course, the more complex the interaction, the more complex the implementation at each end, and this complex demand is often to deal with the malicious behavior of users, in the battle of attack and defense constantly upgraded.

So, back in the day, we might just need a plain image captcha.

I want it to be even simpler

If it is just a common image verification code, the server side uses a library that has image processing in all languages to realize the operation of adding text to the picture.

However, I don’t even want to use these image processing libraries. Is there a way to implement graphic captchas across languages?

You can try seven cattle, early users a month free 10G flow for development testing, enough. Register link

Let’s get this straight

To put it simply, we need a “add text to the picture” scheme, and Qiniu supports the function of adding text watermark on the picture.

So, as long as we achieve: generate random characters -> with random characters in qiniu base map watermark stitching into a picture address -> read watermark pictures and output pictures.

Give a demo

Directly on the code, to a demo for your reference: github.com/wanyaxing/q…

You can also visit here to see the results in action.

After the language

Above, to provide you with a picture verification code generation ideas, as for how to verify the user’s request, that is another matter.

From the original star blog: wanyaxing.com/blog/201908…