diff options
author | Hilmar R <u02@u29lx193> | 2021-02-28 21:06:16 +0100 |
---|---|---|
committer | Hilmar R <u02@u29lx193> | 2021-03-01 18:48:11 +0100 |
commit | c26dede97f626b52b7bf8962ed55d1dbda86abe8 (patch) | |
tree | 3c8c9bc97aa09f7ce9afe9bf467cf87bbf2c7d0b /Zotlabs/Daemon/Thumbnail.php | |
parent | ea3390d626f85b7293a750958bfd1b5460958365 (diff) | |
download | volse-hubzilla-c26dede97f626b52b7bf8962ed55d1dbda86abe8.tar.gz volse-hubzilla-c26dede97f626b52b7bf8962ed55d1dbda86abe8.tar.bz2 volse-hubzilla-c26dede97f626b52b7bf8962ed55d1dbda86abe8.zip |
get dev
Diffstat (limited to 'Zotlabs/Daemon/Thumbnail.php')
-rw-r--r-- | Zotlabs/Daemon/Thumbnail.php | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/Zotlabs/Daemon/Thumbnail.php b/Zotlabs/Daemon/Thumbnail.php index e1f17c304..72034b870 100644 --- a/Zotlabs/Daemon/Thumbnail.php +++ b/Zotlabs/Daemon/Thumbnail.php @@ -5,30 +5,30 @@ namespace Zotlabs\Daemon; class Thumbnail { - static public function run($argc,$argv) { + static public function run($argc, $argv) { - if(! $argc == 2) + if (!$argc == 2) return; $c = q("select * from attach where hash = '%s' ", dbesc($argv[1]) ); - if(! $c) + if (!$c) return; $attach = $c[0]; - $preview_style = intval(get_config('system','thumbnail_security',0)); - $preview_width = intval(get_config('system','thumbnail_width',300)); - $preview_height = intval(get_config('system','thumbnail_height',300)); + $preview_style = intval(get_config('system', 'thumbnail_security', 0)); + $preview_width = intval(get_config('system', 'thumbnail_width', 300)); + $preview_height = intval(get_config('system', 'thumbnail_height', 300)); $p = [ 'attach' => $attach, 'preview_style' => $preview_style, 'preview_width' => $preview_width, 'preview_height' => $preview_height, - 'thumbnail' => null + 'thumbnail' => null ]; /** @@ -40,39 +40,39 @@ class Thumbnail { * * \e string \b thumbnail */ - call_hooks('thumbnail',$p); - if($p['thumbnail']) { + call_hooks('thumbnail', $p); + if ($p['thumbnail']) { return; } $default_controller = null; - + $files = glob('Zotlabs/Thumbs/*.php'); - if($files) { - foreach($files as $f) { - $clsname = '\\Zotlabs\\Thumbs\\' . ucfirst(basename($f,'.php')); - if(class_exists($clsname)) { + if ($files) { + foreach ($files as $f) { + $clsname = '\\Zotlabs\\Thumbs\\' . ucfirst(basename($f, '.php')); + if (class_exists($clsname)) { $x = new $clsname(); - if(method_exists($x,'Match')) { + if (method_exists($x, 'Match')) { $matched = $x->Match($attach['filetype']); - if($matched) { - $x->Thumb($attach,$preview_style,$preview_width,$preview_height); + if ($matched) { + $x->Thumb($attach, $preview_style, $preview_width, $preview_height); } } - if(method_exists($x,'MatchDefault')) { - $default_matched = $x->MatchDefault(substr($attach['filetype'],0,strpos($attach['filetype'],'/'))); - if($default_matched) { + if (method_exists($x, 'MatchDefault')) { + $default_matched = $x->MatchDefault(substr($attach['filetype'], 0, strpos($attach['filetype'], '/'))); + if ($default_matched) { $default_controller = $x; } } } } } - if(($default_controller) - && ((! file_exists(dbunescbin($attach['content']) . '.thumb')) + if (($default_controller) + && ((!file_exists(dbunescbin($attach['content']) . '.thumb')) || (filectime(dbunescbin($attach['content']) . 'thumb') < (time() - 60)))) { - $default_controller->Thumb($attach,$preview_style,$preview_width,$preview_height); + $default_controller->Thumb($attach, $preview_style, $preview_width, $preview_height); } } } |