Index: openacs-4/packages/acs-templating/tcl/captcha-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/Attic/captcha-procs.tcl,v diff -u -r1.1.2.4 -r1.1.2.5 --- openacs-4/packages/acs-templating/tcl/captcha-procs.tcl 28 Jan 2022 09:28:29 -0000 1.1.2.4 +++ openacs-4/packages/acs-templating/tcl/captcha-procs.tcl 31 Jan 2022 11:13:26 -0000 1.1.2.5 @@ -35,7 +35,7 @@ error {'convert' command not available.} } - if {![regexp -nocase {^\d+x\d+$} $size]} { + if {![regexp -nocase {^(\d+)x(\d+)$} $size m width height]} { error {Invalid size} } if {![regexp -nocase {^(\#([0-9]|[a-f]){6}){2}$} ${background}${fill}]} { @@ -51,16 +51,21 @@ set path [ad_tmpnam].png - set wavelength [expr {round(rand() * 100) + 100}] + set amplitude [expr {round($height * 0.25)}] + set wavelength [expr {round($width * 0.75)}] + set offset [expr {round($width * rand())}] exec $convert \ -size $size \ -background $background \ -fill $fill \ label:$text \ - -wave 25%x$wavelength% \ + -splice ${offset}x0+0+0 \ + -wave ${amplitude}x${wavelength} \ + -chop ${offset}x0+0+0 \ $path + if {![file exists $path]} { error "File '$destination' was not generated" }