How to read and render and receive blob in ruby

I am using the homebrew captcha system. This uses Rmagick and Rmagick comes with ImageList. The existing code looks 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)   

      

The code above works fine.

Now we get rid of Rmagick and we use MiniMagick. We have created a large number of images that will appear here randomly. Now that I don't have access to the ImageList, I was wondering how to get the blob data to send. Specifically, how do I get @imgdata withoug using ImageList.

+2


source to share


1 answer


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

      



+2


source







All Articles