aboutsummaryrefslogtreecommitdiffhomepage
path: root/application
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2017-11-11 14:01:21 +0100
committerArthurHoaro <arthur@hoa.ro>2018-07-05 20:31:35 +0200
commite85b7a05a177f803ae36ba5c12835313f31177bc (patch)
tree99216fbcb3343b74eac2589d14bf75c0a6d5fb01 /application
parenta3724717ec37d4bd54dc117ef439c8a182157882 (diff)
downloadShaarli-e85b7a05a177f803ae36ba5c12835313f31177bc.tar.gz
Shaarli-e85b7a05a177f803ae36ba5c12835313f31177bc.tar.zst
Shaarli-e85b7a05a177f803ae36ba5c12835313f31177bc.zip
Update thumbnail integration after rebasing the branch
Diffstat (limited to 'application')
-rw-r--r--application/Thumbnailer.php15
-rw-r--r--application/Updater.php12
2 files changed, 25 insertions, 2 deletions
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 @@
1<?php 1<?php
2 2
3namespace Shaarli;
4
5use Shaarli\Config\ConfigManager;
6use WebThumbnailer\Exception\WebThumbnailerException;
3use WebThumbnailer\WebThumbnailer; 7use WebThumbnailer\WebThumbnailer;
8use WebThumbnailer\Application\ConfigManager as WTConfigManager;
4 9
5/** 10/**
6 * Class Thumbnailer 11 * Class Thumbnailer
@@ -28,7 +33,7 @@ class Thumbnailer
28 { 33 {
29 $this->conf = $conf; 34 $this->conf = $conf;
30 $this->wt = new WebThumbnailer(); 35 $this->wt = new WebThumbnailer();
31 \WebThumbnailer\Application\ConfigManager::addFile('inc/web-thumbnailer.json'); 36 WTConfigManager::addFile('inc/web-thumbnailer.json');
32 $this->wt->maxWidth($this->conf->get('thumbnails.width')) 37 $this->wt->maxWidth($this->conf->get('thumbnails.width'))
33 ->maxHeight($this->conf->get('thumbnails.height')) 38 ->maxHeight($this->conf->get('thumbnails.height'))
34 ->crop(true) 39 ->crop(true)
@@ -44,6 +49,12 @@ class Thumbnailer
44 */ 49 */
45 public function get($url) 50 public function get($url)
46 { 51 {
47 return $this->wt->thumbnail($url); 52 try {
53 return $this->wt->thumbnail($url);
54 } catch (WebThumbnailerException $e) {
55 // Exceptions are only thrown in debug mode.
56 error_log(get_class($e) .': '. $e->getMessage());
57 return false;
58 }
48 } 59 }
49} 60}
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
480 } 480 }
481 481
482 $this->conf->write($this->isLoggedIn); 482 $this->conf->write($this->isLoggedIn);
483 return true;
484 }
483 485
486 /**
487 * * Move thumbnails management to WebThumbnailer, coming with new settings.
488 */
489 public function updateMethodWebThumbnailer()
490 {
491 $this->conf->set('thumbnails.enabled', $this->conf->get('thumbnail.enable_thumbnails', true));
492 $this->conf->set('thumbnails.width', 125);
493 $this->conf->set('thumbnails.height', 90);
494 $this->conf->remove('thumbnail');
495 $this->conf->write(true);
484 return true; 496 return true;
485 } 497 }
486} 498}