Created
December 2, 2013 19:44
-
-
Save StevenAston/7756726 to your computer and use it in GitHub Desktop.
Convert data to base64 and copy it to clipboard on OSX
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
2base64 () { | |
filename=$1; | |
extension="${filename##*.}"; | |
filename="${filename%.*}"; | |
footer='" />'; | |
header='<img width="100%" border="0" src="data:image/'$extension';base64,'; | |
echo 'Converting '$1' to Base64 string.'; | |
data=$(openssl base64 -in $1); | |
echo $header$data$footer | pbcopy; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment