diff options
Diffstat (limited to 'tools/captcha.sh')
-rwxr-xr-x | tools/captcha.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/captcha.sh b/tools/captcha.sh new file mode 100755 index 000000000..2b18d93ad --- /dev/null +++ b/tools/captcha.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +SIGN=$(($RANDOM % 2)) + +R1=$(($RANDOM % 20)) +R2=$(($RANDOM % 10 + 40)) + +if [ $SIGN -eq "0" ]; then + S1=$(( -1*($RANDOM % 20 + 50) )) + S2=$(( $RANDOM % 20 + 50 )) +else + S2=$(( -1*($RANDOM % 20 + 50) )) + S1=$(( $RANDOM % 20 + 50 )) +fi + +convert -size 140x60 xc:white \ + -pointsize 30 -draw "text 20,30 '$1'" \ + -roll -$R2+$R1 -swirl $S1 \ + -roll +$R2-$R1 -swirl $S2 \ + +repage -resize 120x60 \ + -quality 90 -depth 8 png:- |