# Raptcha-0.0.1

**URL:** <https://www.ruby-forum.com/t/raptcha-0-0-1/108796>\
**Category:** Ruby\
**Created:** [July 7, 2007, 5:42am UTC](https://www.ruby-forum.com/t/raptcha-0-0-1/108796 "2007-07-07T05:42:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ara.t.howard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a8b319/32.png) [@ara.t.howard](https://www.ruby-forum.com/u/ara.t.howard)\
**Post date:** [July 7, 2007, 5:42am UTC](https://www.ruby-forum.com/t/raptcha-0-0-1/108796/1 "2007-07-07T05:42:06Z")

</div>

NAME

raptcha

SYNOPSIS

low drain bamage, storage-less, session-less, plugin-less, zero  
admin,  
single-source-file secure captcha system for ruby and/or rails

DESCRIPTION

raptcha manages image generation via a streaming controller. the  
result is  
that no disk storage is ever needed for captcha images. it also  
manages  
authentication via blowfish encoded hidden fields, obviating the  
need for  
session/database interaction for captcha validation. the library  
is useful  
outside of rails, even from the command line.

INSTALL

DEPENDS

### sudo port install ImageMagick rb-rmagick

GEM

```
 gem install raptcha --no-wrappers

```

SINGLE FILE INTO RAILS APP

```
 cp raptcha.rb ./app/lib/

```

URIS

[http://codeforpeople.com/](http://codeforpeople.com/)  
[http://rubyforge.org/projects/codeforpeople](http://rubyforge.org/projects/codeforpeople)

EXAMPLES

GENERATE A SET OF TAGS TO FOR CAPTCHA PLUS FORM INPUT FIELDS

```
 Raptcha.input
   :foreground => 'pink', :background => 'mauve', :distort => 'low'

```

GENERATE AN INLINE (Base64 encoded png) INPUT TAG SET

```
 Raptcha.input((
   :inline => true, :foreground => 'pink', :distort => 'low',
   :width => 142, :height => 42, :type => 'jpg'
 ))

```

USING IN RAILS

```
 1) setup the raptcha controller
   prompt:~/rails_root/ > raptcha generate controller

 2) use in your controllers
 class WickedEasyController < ApplicationController
   def form
     @valid = Raptcha.valid? params

     render :inline => <<-rhtml
       <html> <body>
          valid :<%= valid %>

         <form method=post>
           <%= Raptcha.input %>

           <input type=submit name=submit value=submit />
         </form>
       </body> </html>
     rhtml
   end
 end

```

COMMAND LINE USAGE

```
 ruby raptcha.rb foreground:pink > pink.png && display ping.png

 ruby raptcha.rb generate lib

```

SAMPLES

see [http://drawohara.tumblr.com/post/5125054](http://drawohara.tumblr.com/post/5125054)

DOC

vim raptcha.rb

enjoy.

-a
