Commit b773f7dd8bfa74a5a0fee6f614da1f9b3a2fff86
1 parent
72e34318
Added config settings for imagemagick and pdf2swf. Use the imagemagick config s…
…etting to create thumbnail Committed by: Paul Barrett
Showing
3 changed files
with
42 additions
and
9 deletions
lib/config/config.inc.php
| ... | ... | @@ -73,7 +73,8 @@ class KTConfig { |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | // FIXME nbm: how do we cache errors here? |
| 76 | - function loadCache() { | |
| 76 | + function loadCache() | |
| 77 | + { | |
| 77 | 78 | $filename = $this->getCacheFilename(); |
| 78 | 79 | if($filename === false){ |
| 79 | 80 | return false; |
| ... | ... | @@ -93,7 +94,8 @@ class KTConfig { |
| 93 | 94 | return true; |
| 94 | 95 | } |
| 95 | 96 | |
| 96 | - function createCache() { | |
| 97 | + function createCache() | |
| 98 | + { | |
| 97 | 99 | $filename = $this->getCacheFilename(); |
| 98 | 100 | |
| 99 | 101 | $config_cache = array(); |
| ... | ... | @@ -119,20 +121,21 @@ class KTConfig { |
| 119 | 121 | } |
| 120 | 122 | |
| 121 | 123 | // {{{ readConfig |
| 122 | - function readConfig () { | |
| 124 | + function readConfig () | |
| 125 | + { | |
| 123 | 126 | //Load config data from the database |
| 124 | 127 | $sQuery = 'select group_name, item, value, default_value from config_settings'; |
| 125 | 128 | $confResult = DBUtil::getResultArray($sQuery); |
| 126 | 129 | |
| 127 | - if(PEAR::isError($confResult)){ | |
| 130 | + if(PEAR::isError($confResult)) { | |
| 128 | 131 | return $confResult; |
| 129 | 132 | } |
| 130 | 133 | |
| 131 | 134 | // Update the config array - overwrite the current settings with the settings in the database. |
| 132 | - foreach ($confResult as $confItem) | |
| 133 | - { | |
| 135 | + foreach ($confResult as $confItem) { | |
| 134 | 136 | $this->setns($confItem['group_name'], $confItem['item'], $confItem['value'], $confItem['default_value']); |
| 135 | 137 | } |
| 138 | + | |
| 136 | 139 | $this->populateDefault(); |
| 137 | 140 | } |
| 138 | 141 | // }}} | ... | ... |
plugins/thumbnails/thumbnails.php
| ... | ... | @@ -141,8 +141,7 @@ class thumbnailGenerator extends BaseProcessor { |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | // if there is no pdf that exists - hop out |
| 144 | - if(!file_exists($pdfFile)){ | |
| 145 | - global $default; | |
| 144 | + if(!file_exists($pdfFile)) { | |
| 146 | 145 | $default->log->debug('Thumbnail Generator Plugin: PDF file does not exist, cannot generate a thumbnail'); |
| 147 | 146 | return false; |
| 148 | 147 | } |
| ... | ... | @@ -154,7 +153,7 @@ class thumbnailGenerator extends BaseProcessor { |
| 154 | 153 | |
| 155 | 154 | // do generation |
| 156 | 155 | if (extension_loaded('imagick')) { |
| 157 | - $result= shell_exec("convert -size 200x200 {$pdfFile}[0] -resize 200x200 $thumbnailfile"); | |
| 156 | + $result= KTUtil::pexec("\"{$default->imagemagick}\" -size 200x200 \"{$pdfFile}[0]\" -resize 230x200 \"$thumbnailfile\""); | |
| 158 | 157 | return true; |
| 159 | 158 | }else{ |
| 160 | 159 | $default->log->debug('Thumbnail Generator Plugin: Imagemagick not installed, cannot generate a thumbnail'); | ... | ... |
sql/mysql/upgrade/3.7.0/config_settings.sql
0 → 100644
| 1 | +INSERT INTO `dms`.`config_settings` ( | |
| 2 | +`id` , | |
| 3 | +`group_name` , | |
| 4 | +`display_name` , | |
| 5 | +`description` , | |
| 6 | +`item` , | |
| 7 | +`value` , | |
| 8 | +`default_value` , | |
| 9 | +`type` , | |
| 10 | +`options` , | |
| 11 | +`can_edit` | |
| 12 | +) | |
| 13 | +VALUES ( | |
| 14 | +NULL , 'externalBinary', 'image magick', 'Path to binary', 'imagemagick', 'default', 'convert', 'string', NULL , '1' | |
| 15 | +); | |
| 16 | + | |
| 17 | +INSERT INTO `dms`.`config_settings` ( | |
| 18 | +`id` , | |
| 19 | +`group_name` , | |
| 20 | +`display_name` , | |
| 21 | +`description` , | |
| 22 | +`item` , | |
| 23 | +`value` , | |
| 24 | +`default_value` , | |
| 25 | +`type` , | |
| 26 | +`options` , | |
| 27 | +`can_edit` | |
| 28 | +) | |
| 29 | +VALUES ( | |
| 30 | +NULL , 'externalBinary', 'pdf2swf', 'Path to binary', 'pdf2swf', 'default', 'pdf2swf', 'string', NULL , '1' | |
| 31 | +); | |
| 0 | 32 | \ No newline at end of file | ... | ... |