From e85b7a05a177f803ae36ba5c12835313f31177bc Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Sat, 11 Nov 2017 14:01:21 +0100 Subject: Update thumbnail integration after rebasing the branch --- application/Thumbnailer.php | 15 +++++++++++++-- application/Updater.php | 12 ++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) (limited to 'application') diff --git a/application/Thumbnailer.php b/application/Thumbnailer.php index b669adae..9cf5dacd 100644 --- a/application/Thumbnailer.php +++ b/application/Thumbnailer.php @@ -1,6 +1,11 @@ conf = $conf; $this->wt = new WebThumbnailer(); - \WebThumbnailer\Application\ConfigManager::addFile('inc/web-thumbnailer.json'); + WTConfigManager::addFile('inc/web-thumbnailer.json'); $this->wt->maxWidth($this->conf->get('thumbnails.width')) ->maxHeight($this->conf->get('thumbnails.height')) ->crop(true) @@ -44,6 +49,12 @@ class Thumbnailer */ public function get($url) { - return $this->wt->thumbnail($url); + try { + return $this->wt->thumbnail($url); + } catch (WebThumbnailerException $e) { + // Exceptions are only thrown in debug mode. + error_log(get_class($e) .': '. $e->getMessage()); + return false; + } } } diff --git a/application/Updater.php b/application/Updater.php index dece2c02..6fbe3e00 100644 --- a/application/Updater.php +++ b/application/Updater.php @@ -480,7 +480,19 @@ class Updater } $this->conf->write($this->isLoggedIn); + return true; + } + /** + * * Move thumbnails management to WebThumbnailer, coming with new settings. + */ + public function updateMethodWebThumbnailer() + { + $this->conf->set('thumbnails.enabled', $this->conf->get('thumbnail.enable_thumbnails', true)); + $this->conf->set('thumbnails.width', 125); + $this->conf->set('thumbnails.height', 90); + $this->conf->remove('thumbnail'); + $this->conf->write(true); return true; } } -- cgit v1.2.3