Last active
November 30, 2017 12:45
-
-
Save GWillmann/d7900a94181818d846277411b1f01661 to your computer and use it in GitHub Desktop.
Paperclip file to encoded Base64 Byte array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'base64' | |
byte_array_file = Paperclip.io_adapters.for(attachment.file).read | |
Base64.encode64(byte_array_file) | |
Thanks to Jonathar (https://gist.github.com/jonathar/731c5c4c3273d26f5369#file-paperclip-byte-buffer) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment