<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -3,8 +3,7 @@
 This captcha generator is based on the very fine work of Eric Methot 
 (http://blogs.ericmethot.com/) all credit and thanks should go to him.
 
-This fork fixes an issue that prevents the captcha validation from working
-when you generate images in a file format other than PNG.
+This fork allows you to specify a file type for captcha image generation (png or gif).
 
 Using Captcha is a five step process
 
@@ -62,7 +61,7 @@ Next, generate the images by running the following rake task, this takes a while
    rake captcha:generate COUNT=250
 
 This will create the '/public/system/captcha' directory if it doesn't
-already exist and put 250 randomly generated captcha gifs. 
+already exist and put 250 randomly generated captcha images. 
 
 You can specify the following parameters when running the rake task:
 
@@ -70,7 +69,7 @@ COUNT          - the number of images to generate, default 3
 IMAGE_HEIGHT   - the height of the captcha image in pixels, default 50
 IMAGE_WIDTH    - the width of the captcha image in pixels, default 260
 CAPTCHA_LENGTH - the number of characters in the captcha, default 5
-
+FILE_FORMAT    - the file type of the captcha image (png or gif)
 
 == Use the helper methods
 </diff>
      <filename>README</filename>
    </modified>
    <modified>
      <diff>@@ -12,28 +12,31 @@ module CaptchaImageGenerator
   @@default_parameters = {
     :image_width    =&gt; 240,
     :image_height   =&gt; 50,
-    :captcha_length =&gt; 5
+    :captcha_length =&gt; 5,
+    :file_format =&gt; 'png'
   }
 
   def self.generate_captcha_image(params = {})
 
     params.reverse_merge!(@@default_parameters)
 
-    text_img  = Magick::Image.new(params[:image_width], params[:image_height])
-    black_img = Magick::Image.new(params[:image_width], params[:image_height]) do
+    file_format = ['png', 'gif'].include?(params[:file_format]) ? &quot;.#{params[:file_format]}&quot; : '.png'
+    
+    text_img  = Magick::Image.new(params[:image_width].to_i, params[:image_height].to_i)
+    black_img = Magick::Image.new(params[:image_width].to_i, params[:image_height].to_i) do
       self.background_color = 'black'
     end
 
     # Generate a 5 character random string
-    random_string = (1..params[:captcha_length]).collect { @@eligible_chars[rand(@@eligible_chars.size)] }.join(' ')
+    random_string = (1..params[:captcha_length].to_i).collect { @@eligible_chars[rand(@@eligible_chars.size)] }.join(' ')
 
     # Gerenate the filename based on the string where we have removed the spaces
-    filename = CaptchaUtil::encrypt_string(random_string.gsub(' ', '').downcase) + '.png'
+    filename = CaptchaUtil::encrypt_string(random_string.gsub(' ', '').downcase) + file_format
 
     # Render the text in the image
     text_img.annotate(Magick::Draw.new, 0,0,0,0, random_string) {
       self.gravity = Magick::WestGravity
-      self.font_family = 'times'
+      self.font_family = 'Thonburi'
       self.font_weight = Magick::BoldWeight
       self.fill = '#666666'
       self.stroke = 'black'
@@ -44,7 +47,7 @@ module CaptchaImageGenerator
     # Apply a little blur and fuzzing
     text_img = text_img.gaussian_blur(1.2, 1.2)
     text_img = text_img.sketch(20, 30.0, 30.0)
-    text_img = text_img.wave(7, 90)
+    text_img = text_img.wave(3, 90)
 
     # Now we need to get the white out
     text_mask = text_img.negate</diff>
      <filename>lib/captcha_image_generator.rb</filename>
    </modified>
    <modified>
      <diff>@@ -19,8 +19,8 @@ namespace :captcha do
    
    def resolve_params
      params = {}
-     ['IMAGE_WIDTH', 'IMAGE_HEIGHT', 'CAPTCHA_LENGTH'].each do |param|
-       params[param.downcase.to_sym] = ENV[param].to_i if ENV[param]
+     ['IMAGE_WIDTH', 'IMAGE_HEIGHT', 'CAPTCHA_LENGTH', 'FILE_FORMAT'].each do |param|
+       params[param.downcase.to_sym] = ENV[param] if ENV[param]
      end
      params 
    end </diff>
      <filename>tasks/generate.rake</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>d52a63713b4b18f790c71bde5d3748654814ed29</id>
    </parent>
  </parents>
  <author>
    <name>Corey</name>
    <email>corey@seologic.com</email>
  </author>
  <url>http://github.com/zendesk/captcha/commit/05123e4e11ad3daf57979ee0078f2db92a3e9645</url>
  <id>05123e4e11ad3daf57979ee0078f2db92a3e9645</id>
  <committed-date>2009-06-17T11:14:10-07:00</committed-date>
  <authored-date>2009-06-17T11:14:10-07:00</authored-date>
  <message>Accepts FILE_FORMAT argument on rake task to generate images.</message>
  <tree>1e693f9500525dec563786ffca60f31d8c0fc06a</tree>
  <committer>
    <name>Corey</name>
    <email>corey@seologic.com</email>
  </committer>
</commit>
