Created
October 16, 2011 05:54
-
-
Save carlosmcevilly/1290557 to your computer and use it in GitHub Desktop.
script create an img tag with data for a given .png image file
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
#!/bin/bash | |
# create an <img src=""> tag with data for a given .png image file | |
export in=$1 | |
if [[ "$in" == '' ]]; then | |
echo "usage: $0 infile" | |
exit -1 | |
fi | |
echo -n '<img src="data:image/png;base64,' | |
openssl enc -base64 -in $in | perl -p -e 's/\n//' - | |
echo '">' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment