Created
December 16, 2013 16:10
-
-
Save eduherraiz/7989573 to your computer and use it in GitHub Desktop.
Bash script to get web screenshots using phantomjs
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 | |
URLS_FILE="/var/www/eduherraiz.com/www/snapshots/urls.txt" | |
IMGS_DIR="/var/www/eduherraiz.com/www/snapshots/imgs" | |
for URL in `cat $URLS_FILE` | |
do | |
FILE=`echo ${URL//[\/]/}` | |
#echo $FILE | |
# Create de screenshot with phantomjs | |
phantomjs --ignore-ssl-errors=yes --cookies-file=tempcookies \ | |
/usr/local/phantomjs/rasterize.js \ | |
http://$URL \ | |
$IMGS_DIR/original/$FILE.png | |
convert "$IMGS_DIR/original/$FILE.png" -resize 950 "$IMGS_DIR/resized/$FILE.png" | |
convert "$IMGS_DIR/resized/$FILE.png" -crop 950x700+0+0 "$IMGS_DIR/croped/$FILE.png" | |
convert "$IMGS_DIR/croped/$FILE.png" -resize 182 "$IMGS_DIR/thumb/$FILE.png" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment