26 lines
1 KiB
Bash
26 lines
1 KiB
Bash
|
#!/bin/bash
|
||
|
# inspirated source http://www.cambus.net/blog/page/3/
|
||
|
|
||
|
site=$1
|
||
|
md5Site=$2
|
||
|
thumbWidth=$3
|
||
|
#thumbHeight=$5
|
||
|
|
||
|
#firstLevel=${md5Site:0:2}
|
||
|
#secondLevel=${md5Site:2:2}
|
||
|
#mkdir -p "cache/img/$firstLevel/$secondLevel/"
|
||
|
./bin/phantomjs --ignore-ssl-errors=true /bin/rasterize.js "$site" "cache/tmp/$md5Site.png"
|
||
|
#convert "cache/tmp/$md5Site.png" -crop 1280x1024+0+0 "cache/img/$firstLevel/$secondLevel/$md5Site.png"
|
||
|
#convert "cache/img/$firstLevel/$secondLevel/$md5Site.png" -filter Lanczos -thumbnail "$thumbWidth" "cache/img/$firstLevel/$secondLevel/$md5Site""_thumb.png"
|
||
|
convert "cache/tmp/$md5Site.png" -crop 1280x1024+0+0 "cache/img/$md5Site.png" &&
|
||
|
convert "cache/img/$md5Site.png" -filter Lanczos -thumbnail "$thumbWidth" "cache/img/$md5Site""_thumb.png"
|
||
|
rm "cache/tmp/$md5Site.png"
|
||
|
|
||
|
#if [[ -f "cache/img/$firstLevel/$secondLevel/$md5Site""_thumb.png" && -f "cache/img/$firstLevel/$secondLevel/$md5Site.png" ]]
|
||
|
if [[ -f "cache/img/$md5Site""_thumb.png" && -f "cache/img/$md5Site.png" ]]
|
||
|
then
|
||
|
echo 1
|
||
|
else
|
||
|
echo 0
|
||
|
fi
|