Skip to content

Instantly share code, notes, and snippets.

@dzsodzso63
Last active August 29, 2015 14:04
Show Gist options
  • Save dzsodzso63/58fa488d11fa04ce0650 to your computer and use it in GitHub Desktop.
Save dzsodzso63/58fa488d11fa04ce0650 to your computer and use it in GitHub Desktop.
How to create asset string from a png file
DATAURIPREFIX="data:image/png;base64,"
TINYPNG_API_KEY=[register for one in https://tinypng.com]
api_loc=`curl -i --user api:$TINYPNG_API_KEY --data-binary @$1 https://api.tinypng.com/shrink | grep "Location:" | cut -f 2 -d " "`
echo -n $DATAURIPREFIX; curl -s $api_loc | base64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment