Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6340937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:55:47+00:00 2026-05-24T19:55:47+00:00

I have a rails 3 app where I am using the ‘face’ gem to

  • 0

I have a rails 3 app where I am using the ‘face’ gem to reference the Face.com API. The api method takes a parameter of the form:

:file => File.new(path_to_file, 'rb')

which works.

I am trying to change the flow of the app so that the file can be uploaded via a form, do some work with RMagick and then make the API call, all without saving the file to disk.

I can generate the RMagick ‘Image’ with

image = Magick::Image.from_blob(upload_image_field.read)

I can then manipulate the file with RMagick and even save the results into the database with:

self.data = image.to_blob #normally 'upload_image_field.read' if not using RMagick

My problem is that I can’t change the image file (or the blob) into something that the API will recognize (without saving it to disk and then referencing the file on disk).

For example using this in the API method fails:

:file => image.to_blob 

How do I convert he blob into the same format as

File.new(path_to_file, 'rb')

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T19:55:47+00:00Added an answer on May 24, 2026 at 7:55 pm

    OK, I could be wrong on this one… but I wanted to dig this up. Unfortunately, you just have to live with saving it as a file. The reason is because the API makes an HTTP POST. Unfortunately, this needs to be a file.

    References from: [https://github.com/rociiu/face/tree/master/lib/face]:

    recognition.rb:

    def faces_detect(opts={})
        opts.assert_valid_keys(:urls, :file, :detector, :attributes, :callback, :callback_url)
        make_request(:faces_detect, opts)
    end
    

    utils.rb:

    def make_request(api_method, opts={})
       ....
        response = JSON.parse( RestClient.post(API_METHODS[ api_method ], opts.merge(api_crendential)).body )
       ....
      end
    

    So, why is it a problem to save to a file then?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have jquery working on my Rails app using the gem 'jquery-rails' . I
I have a rails app that is parsing HTML using the nokogiri gem version
I have already implemented some AJAX pagination in my Rails app by using the
I have a RESTful resource in my Rails app called Photo. I'm using Paperclip
I have a jruby/rails app using: jruby 1.4.0 Rails 2.3.5 ActiveMQ 5.3.0 Mule ESB
I have a rails app with a mobile view using jqtouch. If the application
I have a Rails app whose major part is to query another web-service using
I have a rails app running on Heroku. I am using paperclip for some
I have a rails app using delayed job, it works fine in development. However,
So I have a Rails 3 app using Paperclip to crop images. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.