mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-12 12:41:30 +00:00
commands can be assigned to mimetype 'xxx/*' and '*'
This commit is contained in:
parent
787fb4777b
commit
d563333f05
|
@ -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'), array($width, $infile, $target.'.png'), $this->converters[$mimetype]);
|
||||||
|
} elseif(isset($this->converters[$mimeparts[0].'/*'])) {
|
||||||
|
$cmd = str_replace(array('%w', '%f', '%o'), array($width, $infile, $target.'.png'), $this->converters[$mimeparts[0].'/*']);
|
||||||
|
} elseif(isset($this->converters['*'])) {
|
||||||
|
$cmd = str_replace(array('%w', '%f', '%o'), array($width, $infile, $target.'.png'), $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) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user