I am hoping someone can help me understand this. I have a base64 string for an image:
"data:image/jpeg;base64,/9j/4AAQSkZJRgABA..."
I would like to send it using ember's createRecord and commit():
this.get('store').createRecord(Emb.Painting, {name: newName, image: newImage});
Then I want to convert it to StringIO for carrierwave and save it:
StringIO.class_eval { def original_filename; "stringiohaxx.jpg"; end }
io = StringIO.new(Base64.decode64(params[:painting][:image]))
@painting = Painting.create(:name => params[:painting][:name], :image => io )
An image is saved. The image is always corrupted. Do I need to break my break my base64 string into:
data: '/9j/..'
type: 'image/jpeg'
? Any help appreciated.