Created
November 7, 2015 01:23
-
-
Save lachlanjc/8f84c0e16e0ccfa540f9 to your computer and use it in GitHub Desktop.
Quickly Base64-encode images
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
def file_extension(filename) | |
filename.gsub /\w+\./, '' | |
end | |
def base64_img(kind, data) | |
"data:image/#{kind};base64,#{Base64.encode64(data)}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment