better error checking if conversion fails

This commit is contained in:
Uwe Steinmann 2022-04-08 12:44:10 +02:00
parent 91a081325d
commit ad0f3b2cfe
2 changed files with 9 additions and 9 deletions

View File

@ -113,9 +113,11 @@ class SeedDMS_Preview_PdfPreviewer extends SeedDMS_Preview_Base {
$this->lastpreviewfile = $target.'.pdf';
if($target != '' && (!file_exists($target.'.pdf') || filectime($target.'.pdf') < filectime($infile))) {
if($this->conversionmgr) {
// if($this->conversionmgr->hasService($mimetype, 'application/pdf')) {
return $this->conversionmgr->convert($infile, $mimetype, 'application/pdf', $target.'.pdf');
// }
if(!$this->conversionmgr->convert($infile, $mimetype, 'application/pdf', $target.'.pdf')) {
$this->lastpreviewfile = '';
return false;
}
$new = true;
} else {
$cmd = '';
$mimeparts = explode('/', $mimetype, 2);

View File

@ -122,12 +122,10 @@ class SeedDMS_Preview_Previewer extends SeedDMS_Preview_Base {
$this->lastpreviewfile = $target.'.png';
if($target != '' && (!file_exists($target.'.png') || filectime($target.'.png') < filectime($infile))) {
if($this->conversionmgr) {
// if($this->conversionmgr->hasService($mimetype, 'image/png')) {
if(!$this->conversionmgr->convert($infile, $mimetype, 'image/png', $target.'.png', array('width'=>$width))) {
$this->lastpreviewfile = '';
return false;
}
// }
if(!$this->conversionmgr->convert($infile, $mimetype, 'image/png', $target.'.png', array('width'=>$width))) {
$this->lastpreviewfile = '';
return false;
}
$new = true;
} else {
$cmd = '';