Merge branch 'seeddms-4.3.x' into seeddms-5.0.x

This commit is contained in:
Uwe Steinmann 2017-03-02 08:21:40 +01:00
commit defc6b1438
3 changed files with 34 additions and 7 deletions

View File

@ -89,8 +89,13 @@ class SeedDMS_Preview_PdfPreviewer extends SeedDMS_Preview_Base {
$target = $this->previewDir.$dir.md5($infile); $target = $this->previewDir.$dir.md5($infile);
if($target != '' && (!file_exists($target.'.pdf') || filectime($target.'.pdf') < filectime($infile))) { if($target != '' && (!file_exists($target.'.pdf') || filectime($target.'.pdf') < filectime($infile))) {
$cmd = ''; $cmd = '';
$mimeparts = explode('/', $mimetype, 2);
if(isset($this->converters[$mimetype])) { if(isset($this->converters[$mimetype])) {
$cmd = str_replace(array('%f', '%o'), array($infile, $target.'.pdf'), $this->converters[$mimetype]); $cmd = str_replace(array('%f', '%o', '%m'), array($infile, $target.'.pdf', $mimetype), $this->converters[$mimetype]);
} elseif(isset($this->converters[$mimeparts[0].'/*'])) {
$cmd = str_replace(array('%f', '%o', '%m'), array($infile, $target.'.pdf', $mimetype), $this->converters[$mimeparts[0].'/*']);
} elseif(isset($this->converters['*'])) {
$cmd = str_replace(array('%f', '%o', '%m'), array($infile, $target.'.pdf', $mimetype), $this->converters['*']);
} }
if($cmd) { if($cmd) {
try { try {

View File

@ -106,9 +106,15 @@ class SeedDMS_Preview_Previewer extends SeedDMS_Preview_Base {
$target = $this->previewDir.$dir.md5($infile).'-'.$width; $target = $this->previewDir.$dir.md5($infile).'-'.$width;
if($target != '' && (!file_exists($target.'.png') || filectime($target.'.png') < filectime($infile))) { if($target != '' && (!file_exists($target.'.png') || filectime($target.'.png') < filectime($infile))) {
$cmd = ''; $cmd = '';
$mimeparts = explode('/', $mimetype, 2);
if(isset($this->converters[$mimetype])) { if(isset($this->converters[$mimetype])) {
$cmd = str_replace(array('%w', '%f', '%o'), array($width, $infile, $target.'.png'), $this->converters[$mimetype]); $cmd = str_replace(array('%w', '%f', '%o', '%m'), array($width, $infile, $target.'.png', $mimetype), $this->converters[$mimetype]);
} elseif(isset($this->converters[$mimeparts[0].'/*'])) {
$cmd = str_replace(array('%w', '%f', '%o', '%m'), array($width, $infile, $target.'.png', $mimetype), $this->converters[$mimeparts[0].'/*']);
} elseif(isset($this->converters['*'])) {
$cmd = str_replace(array('%w', '%f', '%o', '%m'), array($width, $infile, $target.'.png', $mimetype), $this->converters['*']);
} }
/* /*
switch($mimetype) { switch($mimetype) {
case "image/png": case "image/png":
@ -131,7 +137,6 @@ class SeedDMS_Preview_Previewer extends SeedDMS_Preview_Base {
} }
*/ */
if($cmd) { if($cmd) {
//exec($cmd);
try { try {
self::execWithTimeout($cmd, $this->timeout); self::execWithTimeout($cmd, $this->timeout);
} catch(Exception $e) { } catch(Exception $e) {

View File

@ -11,10 +11,10 @@
<email>uwe@steinmann.cx</email> <email>uwe@steinmann.cx</email>
<active>yes</active> <active>yes</active>
</lead> </lead>
<date>2016-11-15</date> <date>2017-03-02</date>
<time>21:00:26</time> <time>07:14:59</time>
<version> <version>
<release>1.2.1</release> <release>1.2.2</release>
<api>1.2.0</api> <api>1.2.0</api>
</version> </version>
<stability> <stability>
@ -23,7 +23,8 @@
</stability> </stability>
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license> <license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes> <notes>
setConverters() overrides exiting converters commands can be set for mimetypes 'xxxx/*' and '*'
pass mimetype as parameter '%m' to converter
</notes> </notes>
<contents> <contents>
<dir baseinstalldir="SeedDMS" name="/"> <dir baseinstalldir="SeedDMS" name="/">
@ -254,5 +255,21 @@ check if cache dir exists before deleting it in deleteDocumentPreviews()
add new previewer which converts document to pdf instead of png add new previewer which converts document to pdf instead of png
</notes> </notes>
</release> </release>
<release>
<date>2016-11-15</date>
<time>21:00:26</time>
<version>
<release>1.2.1</release>
<api>1.2.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</stability>
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes>
setConverters() overrides exiting converters
</notes>
</release>
</changelog> </changelog>
</package> </package>