diff options
author | zotlabs <mike@macgirvin.com> | 2017-11-22 15:43:48 -0800 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2017-11-22 15:43:48 -0800 |
commit | 9936670f44b53e391d997fd024faa329b8a0c803 (patch) | |
tree | a88c45c92843703049a91cf7b4ab4e374b52de97 /Zotlabs/Daemon/Thumbnail.php | |
parent | 6ac3fc4e0724a881ed3b26fa8d0912f38512d2ca (diff) | |
parent | b4f8f4df7bc5cc8a74240506cd536224cb31e114 (diff) | |
download | volse-hubzilla-9936670f44b53e391d997fd024faa329b8a0c803.tar.gz volse-hubzilla-9936670f44b53e391d997fd024faa329b8a0c803.tar.bz2 volse-hubzilla-9936670f44b53e391d997fd024faa329b8a0c803.zip |
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into dev_merge
Diffstat (limited to 'Zotlabs/Daemon/Thumbnail.php')
-rw-r--r-- | Zotlabs/Daemon/Thumbnail.php | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/Zotlabs/Daemon/Thumbnail.php b/Zotlabs/Daemon/Thumbnail.php index caf5dd3ae..e1f17c304 100644 --- a/Zotlabs/Daemon/Thumbnail.php +++ b/Zotlabs/Daemon/Thumbnail.php @@ -17,11 +17,35 @@ class Thumbnail { 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)); - $attach = $c[0]; + $p = [ + 'attach' => $attach, + 'preview_style' => $preview_style, + 'preview_width' => $preview_width, + 'preview_height' => $preview_height, + 'thumbnail' => null + ]; + + /** + * @hooks thumbnail + * * \e array \b attach + * * \e int \b preview_style + * * \e int \b preview_width + * * \e int \b preview_height + * * \e string \b thumbnail + */ + + call_hooks('thumbnail',$p); + if($p['thumbnail']) { + return; + } + + $default_controller = null; $files = glob('Zotlabs/Thumbs/*.php'); @@ -45,7 +69,9 @@ class Thumbnail { } } } - 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); } } |