无论如何在Ruby on Rails中转换图像URL(https://meo-fb-natal-dev.s3.amazonaws.com/participations/cropped/56658c5de2fc7116340000c0/635769180217506883-GD5A9264.jpg?1449495643)中托管的图像Base64编码?
我已经尝试了很多东西,但它们似乎都没有用.
究竟什么不起作用?
这是一个例子:
$> irb >> require 'open-uri' >> img = open("https://meo-fb-natal-dev.s3.amazonaws.com/participations/cropped/56658c5de2fc7116340000c0/635769180217506883-GD5A9264.jpg?1449495643") # img variable is a tempfile with image >> require 'base64' >> Base64.encode64(img.read) => "/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJ\nChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/\n2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgo\nKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAFTAoYDASIAAhEBAxEB/8QA\nHAAAAAcBAQAAAAAAAAAAAAAAAQIDBAUGBwAI/8QAShAAAgEDAgQEAwUGB..."