Last night I got my CAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart) working in Seaside (Squeak Smalltalk). I want users to have to type a random word image in on registration to help keep spam bots away from the site.
Here is what I did:
| textMorph | textMorph := TextMorph new. textMorph contentsAsIs: ( Text string: self randomString attributes: ( Array with: TextEmphasis struckOut with: TextEmphasis italic with: (TextFontReference toFont: (StrikeFont familyName: #BitstreamVeraSans size: 36)) )).
html tableRow with: [ html tableData colspan: 2; align: 'center'; with: [html imageForm: textMorph imageForm]]. html tableRow with: [ html tableData with: 'Verification word:'. html tableData with: [html textInput on: #verificationWord of: self]]
I got a some help from my buddy Blaine Buxton with rendering a morph into a jpeg image. Thanks Blaine!