diff --git a/bin/thumb_server.sh b/bin/thumb_server.sh index ffba1cd..53a1820 100755 --- a/bin/thumb_server.sh +++ b/bin/thumb_server.sh @@ -10,12 +10,17 @@ onlyThumb=$4 # make only thumbshot no full size image waitForResult=$5 # if true we try to make soon as possible or add to queue maxThread=3 # max parralle work for me the best is nb core - 1 timeOut=60 # default time out after this time the site are declared in error -log=true # log all generation success and error +log=false # log all generation success and error randomSleep=`echo $((RANDOM%20))` optimizeTool='' # external tool form optimize png maxQueue=50 # max process in queue currentProcess=$(ps -e | grep -v grep | grep thumb_ | wc -l) +if [ ! -f "cache/tmp/$md5Site.png" ] +then + source "../cache/config/serverOptions.php" +fi + if [ $currentProcess -gt $maxQueue ] then exit diff --git a/index.php b/index.php index 0df6f38..682e63d 100644 --- a/index.php +++ b/index.php @@ -69,6 +69,19 @@ function testExistImg($file) { } } + +/** + * Run the bash script for generate thumbnail + * + * @author Knah Tsaeb + * @date 2013-02-12 + * @param $url (string) url for thumbshot + * @param $md5Url (md5) md5($url) + * @param $width (string) size of thumbnail 190x90 + * @param $onlyThumb (bool) + * @param $waiForResult (bool) + * @return + */ function launchScript($url, $md5Url, $width, $onlyThumb, $waitForResult = false) { $md5Url = escapeshellarg($md5Url); $url = escapeshellarg($url); @@ -168,11 +181,17 @@ function install() { if (!is_file('cache/config/genConf.php')) { file_put_contents('cache/config/genConf.php', ""); } + if (!is_file('cache/config/serverOptions.php')) { + touch('cache/config/serverOptions.php'); + } + if (!is_file('cache/config/options.php')) { + file_put_contents('cache/config/options.php', ""); + } if (!is_file('cache/logs/banUser.php')) { file_put_contents('cache/logs/banUser.php', ""); } - if (!is_file('cache/logs/log.php')) { - touch('cache/logs/log.php'); + if (!is_file('cache/logs/log.txt')) { + touch('cache/logs/log.txt'); } echo '
', $serverKey, '