I\'m trying to upload an image to PingFM. Their documentation says:
media – base64 encoded media data.
I can access this image via the URL.
The open method:
open
open("http://image.com/img.jpg")
is returning a Tempfile object, while encode64 expects a String.
encode64
Calling read on the tempfile should do the trick:
read
ActiveSupport::Base64.encode64(open("http://image.com/img.jpg") { |io| io.read })