Last active
August 29, 2015 14:19
-
-
Save OdinsHat/6b6d1e7a42d321b160b6 to your computer and use it in GitHub Desktop.
PDF to Jpeg convertor script. Instructions in comments.
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/sh | |
# Need 2 directories: | |
# 1 ./toprocess | |
# 2 ./processed | |
# | |
# PHP dumps PDFs into "toprocess" dir. | |
# This script then converts and dump jpgs into "processed" | |
# Then deletes pdf contents of current directory. | |
# | |
# Run this script via crontab as so: | |
# | |
# 10,20,30,40,50 * * * * cd /full/path/to/this/scriptdir/ && ./pdfcon.sh | |
count=`ls -1 *.pdf 2>/dev/null | wc -l` | |
if [ $count != 0 ]; then | |
for i in *.pdf; | |
do | |
convert -density 300 $i -antialias -resize 2160x4462 ./processed/$i.jpg; | |
done | |
rm -f *.pdf; | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment