Adding cache folder if nto exist
This commit is contained in:
parent
ef5d967aa5
commit
c19829233a
3
api.php
3
api.php
@ -49,7 +49,8 @@ if(!$cache)
|
|||||||
$cache = md5(time().rand(1,2000));
|
$cache = md5(time().rand(1,2000));
|
||||||
$hash = $cache.'-'.preg_replace("/[^A-Za-z0-9 ]/", '', $url).'.'.$ft;
|
$hash = $cache.'-'.preg_replace("/[^A-Za-z0-9 ]/", '', $url).'.'.$ft;
|
||||||
|
|
||||||
|
if(!is_dir(__DIR__.'/cache/'))
|
||||||
|
mkdir(__DIR__.'/cache/');
|
||||||
$file = __DIR__.'/cache/'.$hash;
|
$file = __DIR__.'/cache/'.$hash;
|
||||||
if(!file_exists($file))
|
if(!file_exists($file))
|
||||||
shell_exec('timeout '.$timeout.' /usr/sbin/wkhtmltoimage '.escapeshellcmd($vp.$jsp.'-f '.$ft.' '.$url.' '.$file));
|
shell_exec('timeout '.$timeout.' /usr/sbin/wkhtmltoimage '.escapeshellcmd($vp.$jsp.'-f '.$ft.' '.$url.' '.$file));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user