aboutsummaryrefslogtreecommitdiffhomepage
path: root/application
diff options
context:
space:
mode:
Diffstat (limited to 'application')
-rw-r--r--application/Thumbnailer.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/application/Thumbnailer.php b/application/Thumbnailer.php
index 9cf5dacd..d2284e79 100644
--- a/application/Thumbnailer.php
+++ b/application/Thumbnailer.php
@@ -32,6 +32,14 @@ class Thumbnailer
32 public function __construct($conf) 32 public function __construct($conf)
33 { 33 {
34 $this->conf = $conf; 34 $this->conf = $conf;
35
36 if (! $this->checkRequirements()) {
37 $this->conf->set('thumbnails.enabled', false);
38 $this->conf->write(true);
39 // TODO: create a proper error handling system able to catch exceptions...
40 die(t('php-gd extension must be loaded to use thumbnails. Thumbnails are now disabled. Please reload the page.'));
41 }
42
35 $this->wt = new WebThumbnailer(); 43 $this->wt = new WebThumbnailer();
36 WTConfigManager::addFile('inc/web-thumbnailer.json'); 44 WTConfigManager::addFile('inc/web-thumbnailer.json');
37 $this->wt->maxWidth($this->conf->get('thumbnails.width')) 45 $this->wt->maxWidth($this->conf->get('thumbnails.width'))
@@ -57,4 +65,13 @@ class Thumbnailer
57 return false; 65 return false;
58 } 66 }
59 } 67 }
68
69 /**
70 * Make sure that requirements are match to use thumbnails:
71 * - php-gd is loaded
72 */
73 protected function checkRequirements()
74 {
75 return extension_loaded('gd');
76 }
60} 77}