From 1b93137e16694f52952c930848e1a7928e8a00a6 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Wed, 9 Nov 2016 18:57:02 +0100 Subject: Use web-thumbnailer to retrieve thumbnails * requires PHP 5.6 * use blazy on linklist since a lot more thumbs are retrieved * thumbnails can be disabled * thumbs size is now 120x120 * thumbs are now cropped to fit the expected size Fixes #345 #425 #487 #543 #588 #590 --- application/PageBuilder.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'application/PageBuilder.php') diff --git a/application/PageBuilder.php b/application/PageBuilder.php index a4483870..3dba7677 100644 --- a/application/PageBuilder.php +++ b/application/PageBuilder.php @@ -105,6 +105,11 @@ class PageBuilder if ($this->linkDB !== null) { $this->tpl->assign('tags', $this->linkDB->linksCountPerTag()); } + + $this->tpl->assign('thumbnails_enabled', $this->conf->get('thumbnails.enabled')); + $this->tpl->assign('thumbnails_width', $this->conf->get('thumbnails.width')); + $this->tpl->assign('thumbnails_height', $this->conf->get('thumbnails.height')); + // To be removed with a proper theme configuration. $this->tpl->assign('conf', $this->conf); } -- cgit v1.2.3 From 28f26524609338316cc6e51c743058e6e8c7b12b Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Fri, 8 Jun 2018 12:50:49 +0200 Subject: Add a page to update all thumbnails through AJAX requests in both templates --- application/PageBuilder.php | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'application/PageBuilder.php') diff --git a/application/PageBuilder.php b/application/PageBuilder.php index 3dba7677..5da70811 100644 --- a/application/PageBuilder.php +++ b/application/PageBuilder.php @@ -21,11 +21,21 @@ class PageBuilder */ protected $conf; + /** + * @var array $_SESSION + */ + protected $session; + /** * @var LinkDB $linkDB instance. */ protected $linkDB; - + + /** + * @var null|string XSRF token + */ + protected $token; + /** @var bool $isLoggedIn Whether the user is logged in **/ protected $isLoggedIn = false; @@ -33,14 +43,17 @@ class PageBuilder * PageBuilder constructor. * $tpl is initialized at false for lazy loading. * - * @param ConfigManager $conf Configuration Manager instance (reference). - * @param LinkDB $linkDB instance. - * @param string $token Session token + * @param ConfigManager $conf Configuration Manager instance (reference). + * @param array $session $_SESSION array + * @param LinkDB $linkDB instance. + * @param string $token Session token + * @param bool $isLoggedIn */ - public function __construct(&$conf, $linkDB = null, $token = null, $isLoggedIn = false) + public function __construct(&$conf, $session, $linkDB = null, $token = null, $isLoggedIn = false) { $this->tpl = false; $this->conf = $conf; + $this->session = $session; $this->linkDB = $linkDB; $this->token = $token; $this->isLoggedIn = $isLoggedIn; @@ -110,6 +123,11 @@ class PageBuilder $this->tpl->assign('thumbnails_width', $this->conf->get('thumbnails.width')); $this->tpl->assign('thumbnails_height', $this->conf->get('thumbnails.height')); + if (! empty($_SESSION['warnings'])) { + $this->tpl->assign('global_warnings', $_SESSION['warnings']); + unset($_SESSION['warnings']); + } + // To be removed with a proper theme configuration. $this->tpl->assign('conf', $this->conf); } -- cgit v1.2.3 From b302b3c584b84f22f0e6f187b072180ecbacdfab Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Thu, 5 Jul 2018 20:29:55 +0200 Subject: Thumbnails: add a common mode to only retrieve thumbs from popular media websites --- application/PageBuilder.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'application/PageBuilder.php') diff --git a/application/PageBuilder.php b/application/PageBuilder.php index 5da70811..b1abe0d0 100644 --- a/application/PageBuilder.php +++ b/application/PageBuilder.php @@ -1,6 +1,7 @@ tpl->assign('tags', $this->linkDB->linksCountPerTag()); } - $this->tpl->assign('thumbnails_enabled', $this->conf->get('thumbnails.enabled')); + $this->tpl->assign( + 'thumbnails_enabled', + $this->conf->get('thumbnails.mode', Thumbnailer::MODE_NONE) !== Thumbnailer::MODE_NONE + ); $this->tpl->assign('thumbnails_width', $this->conf->get('thumbnails.width')); $this->tpl->assign('thumbnails_height', $this->conf->get('thumbnails.height')); -- cgit v1.2.3