diff options
Diffstat (limited to 'application/Thumbnailer.php')
-rw-r--r-- | application/Thumbnailer.php | 15 |
1 files changed, 13 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 | ||
3 | namespace Shaarli; | ||
4 | |||
5 | use Shaarli\Config\ConfigManager; | ||
6 | use WebThumbnailer\Exception\WebThumbnailerException; | ||
3 | use WebThumbnailer\WebThumbnailer; | 7 | use WebThumbnailer\WebThumbnailer; |
8 | use 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 | } |