How to decode base64 image file with mini_magick in Rails?
问题 In our Rails 4 app, the image is uploaded to server in a base64 string: uploaded_io = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2....." We would like to to retrieve the content type, size and so on and save the file as image file on file system. There is a gem 'mini_magick' in our app. Is there a way to process base64 image string with mini_magick ? 回答1: Yes, there is a way to do that. Strip metadata "data:image/jpeg;base64," from your input string and then decode it with Base64