Commit 83f0dcfaeb360a11717f1fe2f07a5af2271bf677

Authored by Jarrett Jordaan
2 parents 5752e1b7 7fbb4d57

Merge branch 'edge' of git@github.com:ktgit/knowledgetree into edge

plugins/thumbnails/thumbnails.php
... ... @@ -147,10 +147,10 @@ class thumbnailGenerator extends BaseProcessor
147 147 $mimeType = KTMime::getMimeTypeName($mimeTypeId);
148 148  
149 149 // Get the pdf source file - if the document is a pdf then use the document as the source
150   - if($mimeType == 'application/pdf'){
  150 + if($mimeType == 'application/pdf') {
151 151 $pdfDir = $default->documentRoot;
152 152 $pdfFile = $pdfDir . DIRECTORY_SEPARATOR . $this->document->getStoragePath();
153   - }else{
  153 + } else {
154 154 $pdfDir = $default->pdfDirectory;
155 155 $pdfFile = $pdfDir .DIRECTORY_SEPARATOR. $this->document->iId.'.pdf';
156 156 }
... ... @@ -175,28 +175,23 @@ class thumbnailGenerator extends BaseProcessor
175 175 $default->log->debug('Thumbnail Generator Plugin: PDF file does not exist, cannot generate a thumbnail');
176 176 return false;
177 177 }
178   - // if a previous version of the thumbnail exists - delete it
  178 +
  179 + // if a previous version of the thumbnail exists - delete it
179 180 if (file_exists($thumbnailfile)) {
180 181 @unlink($thumbnailfile);
181 182 }
182 183 // do generation
183   - // if (extension_loaded('imagick')) {
184   - $pathConvert = (!empty($default->convertPath)) ? $default->convertPath : 'convert';
185   - // windows path may contain spaces
186   -
187   - if (stristr(PHP_OS,'WIN')) {
188   - $cmd = "\"{$pathConvert}\" -size 200x200 \"{$pdfFile}[0]\" -resize 200x200 \"$thumbnailfile\"";
189   - }
190   - else {
191   - $cmd = "{$pathConvert} -size 200x200 {$pdfFile}[0] -resize 200x200 $thumbnailfile";
192   - }
193   - $result = KTUtil::pexec($cmd);
194   - return true;
195   - //}else{
196   - //$default->log->debug('Thumbnail Generator Plugin: Imagemagick not installed, cannot generate a thumbnail');
197   - // return false;
198   - //}
199   -
  184 + $pathConvert = (!empty($default->convertPath)) ? $default->convertPath : 'convert';
  185 + // windows path may contain spaces
  186 + if (stristr(PHP_OS,'WIN')) {
  187 + $cmd = "\"{$pathConvert}\" -size 200x200 \"{$pdfFile}[0]\" -resize 200x200 \"$thumbnailfile\"";
  188 + }
  189 + else {
  190 + $cmd = "{$pathConvert} -size 200x200 {$pdfFile}[0] -resize 200x200 $thumbnailfile";
  191 + }
  192 +
  193 + $result = KTUtil::pexec($cmd);
  194 + return true;
200 195 }
201 196 }
202 197  
... ...
setup/wizard/steps/database.php
... ... @@ -802,18 +802,18 @@ class database extends Step
802 802 'unzip' => array(0 => 'import', 1 => SYSTEM_ROOT . 'bin\unzip\unzip.exe'));
803 803  
804 804 if (INSTALL_TYPE == 'commercial' || true) {
805   - $winBinaries['pdf2swf'] = array(0 => 'externalBinary', 1 => SYSTEM_ROOT . 'bin\pdf2swf.exe');
  805 + $winBinaries['pdf2swf'] = array(0 => 'externalBinary', 1 => SYSTEM_ROOT . 'bin\swftools\pdf2swf.exe');
806 806 }
807 807  
808 808 foreach ($winBinaries as $displayName => $bin)
809 809 {
810 810 // continue without attempting to set the path if we can't find the file in the specified location
811   - if (!file_exists($bin[1])) continue;
  811 +// if (!file_exists($bin[1])) continue;
812 812  
813 813 // instaView won't exist, must be inserted instead of updated
814 814 if ($displayName == 'pdf2swf') {
815 815 $updateBin = 'INSERT INTO `config_settings` (group_name, display_name, description, item, value, default_value, type, options, can_edit) '
816   - . 'VALUES ("' . $bin[0] . '", "pdf2swf", "The path to the SWFTools \"pdf2swf\" binary", "pdf2swfPath", '
  816 + . 'VALUES ("' . $bin[0] . '", "' . $displayName . '", "The path to the SWFTools \"pdf2swf\" binary", "pdf2swfPath", '
817 817 . '"' . str_replace('\\', '\\\\', $bin[1]) . '", "pdf2swf", "string", NULL, 1);';
818 818 }
819 819 else {
... ...