masroorejaz / react-simple-captcha

A very simple and powerful captcha for ReactJS
40 stars 19 forks source link

Can I resize the capcha size without make it blur ? #21

Closed kuzanto closed 2 years ago

kuzanto commented 2 years ago

Can I resize the capcha size without make it blur ? I tried to change Canvas width with css but make the text blur.

masroorejaz commented 2 years ago

Hello,

It's really simple go to node_modules/react-simple-captcha/react-simple-captcha.js

If you want to change the height go to line number 55 and change the value of 30 to your desired height value:

let lineheight = 30;

If you want to change the width go to line number 62 and change value of 25 to your desired width value:

ctx.canvas.width = parseInt(length) * 25;

Also restart react server cause it does not show node_modules changes on runtime.

Plus when you deploy it on the live server you need to make these changes and publish your own npm otherwise these changes will be overwrite if you install it with npm. Other hack is you can make these changes after installing it on live server but make sure to not install or update it otherwise it will revert to default.

If you have any other questions do let me know.

Thank you, Masroor Ejaz.