[add] option for make only thumb not thumb+full
This commit is contained in:
parent
ecf67b8d17
commit
fbfe8540ef
2 changed files with 24 additions and 9 deletions
|
@ -4,7 +4,7 @@
|
||||||
site=$1
|
site=$1
|
||||||
md5Site=$2
|
md5Site=$2
|
||||||
thumbWidth=$3
|
thumbWidth=$3
|
||||||
#thumbHeight=$5
|
onlyThumb=$4
|
||||||
|
|
||||||
#firstLevel=${md5Site:0:2}
|
#firstLevel=${md5Site:0:2}
|
||||||
#secondLevel=${md5Site:2:2}
|
#secondLevel=${md5Site:2:2}
|
||||||
|
@ -12,14 +12,28 @@ thumbWidth=$3
|
||||||
./bin/phantomjs --ignore-ssl-errors=true /bin/rasterize.js "$site" "cache/tmp/$md5Site.png"
|
./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/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/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" &&
|
if [ $onlyThumb ]
|
||||||
convert "cache/img/$md5Site.png" -filter Lanczos -thumbnail "$thumbWidth" "cache/img/$md5Site""_thumb.png"
|
then
|
||||||
|
convert "cache/tmp/$md5Site.png" -crop 1280x1024+0+0 -filter Lanczos -thumbnail "$thumbWidth" "cache/img/$md5Site""_thumb.png"
|
||||||
|
else
|
||||||
|
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"
|
||||||
|
fi
|
||||||
rm "cache/tmp/$md5Site.png"
|
rm "cache/tmp/$md5Site.png"
|
||||||
|
|
||||||
#if [[ -f "cache/img/$firstLevel/$secondLevel/$md5Site""_thumb.png" && -f "cache/img/$firstLevel/$secondLevel/$md5Site.png" ]]
|
if [ $onlyThumb ]
|
||||||
if [[ -f "cache/img/$md5Site""_thumb.png" && -f "cache/img/$md5Site.png" ]]
|
|
||||||
then
|
then
|
||||||
|
if [[ -f "cache/img/$md5Site""_thumb.png" ]]
|
||||||
|
then
|
||||||
echo 1
|
echo 1
|
||||||
else
|
else
|
||||||
echo 0
|
echo 0
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [[ -f "cache/img/$md5Site""_thumb.png" && -f "cache/img/$md5Site.png" ]]
|
||||||
|
then
|
||||||
|
echo 1
|
||||||
|
else
|
||||||
|
echo 0
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -9,6 +9,7 @@ $GLOBALS['config']['maxErrorBeforeBan'] = 3;
|
||||||
$GLOBALS['config']['banTime'] = 60;
|
$GLOBALS['config']['banTime'] = 60;
|
||||||
$GLOBALS['config']['defaultUrl'] = 'https://google.com';
|
$GLOBALS['config']['defaultUrl'] = 'https://google.com';
|
||||||
$GLOBALS['config']['defaultThumbSize'] = '120x90';
|
$GLOBALS['config']['defaultThumbSize'] = '120x90';
|
||||||
|
$GLOBALS['config']['onlyThumb'] = true;
|
||||||
$GLOBALS['config']['thumbSize'] = array(1 => '100x80', '120x90', '200x160', '300x240', '400x320', '500x400');
|
$GLOBALS['config']['thumbSize'] = array(1 => '100x80', '120x90', '200x160', '300x240', '400x320', '500x400');
|
||||||
|
|
||||||
if (!file_exists('cache/config/genConf.php')) {
|
if (!file_exists('cache/config/genConf.php')) {
|
||||||
|
@ -44,11 +45,11 @@ function testExistImg($file) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function launchScript($url, $md5Url, $width, $height = '') {
|
function launchScript($url, $md5Url, $width) {
|
||||||
$md5Url = escapeshellarg($md5Url);
|
$md5Url = escapeshellarg($md5Url);
|
||||||
$url = escapeshellarg($url);
|
$url = escapeshellarg($url);
|
||||||
$width = escapeshellarg($width);
|
$width = escapeshellarg($width);
|
||||||
exec('bin/thumb_server.sh ' . $url . ' ' . $md5Url . ' ' . $width . ' ' . $height, $result);
|
exec('bin/thumb_server.sh ' . $url . ' ' . $md5Url . ' ' . $width . ' ' . (bool)$GLOBALS['config']['onlyThumb'], $result);
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue