diff options
author | Mathias Bynens <mathias@qiwi.be> | 2012-03-22 13:32:14 +0100 |
---|---|---|
committer | Mathias Bynens <mathias@qiwi.be> | 2012-03-22 13:32:14 +0100 |
commit | 36666d6b7214ef4537ed336ac6513ea80c15aa70 (patch) | |
tree | 3afdb34237f103016b64a55d82b5ce22f896a1c6 | |
parent | 1c94b9b3802a2af987ff3ef03c8f1730368cba7e (diff) | |
download | dotfiles-36666d6b7214ef4537ed336ac6513ea80c15aa70.tar.gz dotfiles-36666d6b7214ef4537ed336ac6513ea80c15aa70.tar.bz2 dotfiles-36666d6b7214ef4537ed336ac6513ea80c15aa70.zip |
.functions: Add `dataurl` function
Based on @lri’s http://lri.me/profile.
-rw-r--r-- | .functions | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -3,6 +3,11 @@ function md() { mkdir -p "$@" && cd "$@" } +# Create a data URL from an image (works for other file types too, if you tweak the Content-Type afterwards) +dataurl() { + echo "data:image/${1##*.};base64,$(openssl base64 -in "$1")" | tr -d '\n' +} + # Start an HTTP server from a directory, optionally specifying the port function server() { local port="${1:-8000}" |