views:

223

answers:

1

I am using a homegrown captcha system. This uses Rmagick and Rmagick comes with ImageList. Existing code is like this.

  im = ImageList.new("#{@@captcha_image_path}/#{captcha.pos}.JPG")
  @imgdata = im.to_blob

    send_data(@imgdata, :filename => 'captcha.jpg', 
                        :type => 'image/jpeg', 
                        :disposition => 'inline', 
                        :nocache => Time.zone.now)

Above code works fine.

Now we are getting rid of Rmagick and we are using MiniMagick. We have generated some large number of images that will be displayed in random here. Now that I do not have access to ImageList, I was wondering how to get the blob data to be sent. Specifically how do I get @imgdata withoug using ImageList.

+1  A: 
send_file '/path/to/image/file.jpg', :type=>"application/jpeg"
bensie