Created
December 22, 2011 09:25
-
-
Save itsbth/1509656 to your computer and use it in GitHub Desktop.
Uploaded by UploadToGist for Sublime Text 2
This file contains hidden or 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 | |
| SIZE="1280x720" | |
| THUMB="512x512" | |
| OUT="mc.itsbth.com:/var/www/img/w/" | |
| WEB="http://img.itsbth.com/w/" | |
| TITLE=$(curl "$1" 2> /dev/null | perl -ne '$_ =~ m#<title>(.+)</title># and print $1') | |
| TITLE=$(perl -e '$ARGV[0] =~ s/[^A-Za-z0-9]+/-/g; print $ARGV[0]' "$TITLE") | |
| FILENAME="${TITLE}_$(date '+%d-%m-%y_%H-%M-%S')" | |
| echo "Capturing page..." | |
| phantomjs $HOME/scripts/rasterize.coffee "$1" "$FILENAME.png" "$SIZE" | |
| convert "$FILENAME.png" -thumbnail "$THUMB" "${FILENAME}_thumb.png" | |
| echo "Uploading screenshot..." | |
| scp "$FILENAME.png" "${FILENAME}_thumb.png" "$OUT" > /dev/null | |
| rm "$FILENAME.png" "${FILENAME}_thumb.png" | |
| echo "Full size: ${WEB}${FILENAME}.png" | |
| echo "Thumbnail: ${WEB}${FILENAME}_thumb.png" | |
| echo "Forum: [url=${WEB}${FILENAME}.png][img]${WEB}${FILENAME}_thumb.png[/img][/url]" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment