Correzione visualizzazione allegati

This commit is contained in:
Dasc3er 2021-08-03 14:51:53 +02:00
parent 884da4fdae
commit e4148b634b
2 changed files with 8 additions and 5 deletions

View File

@ -206,7 +206,7 @@ class Upload extends Model
*/
public function isImage()
{
$list = ['jpg', 'png', 'gif', 'jpeg', 'bmp', 'svg'];
$list = ['jpg', 'png', 'gif', 'jpeg', 'bmp'];
return in_array($this->extension, $list);
}

View File

@ -91,11 +91,14 @@ if ($file->isFatturaElettronica()) {
if ($file->isImage()) {
echo '
<img src="'.$link.'"></img>';
} else {
if ($file->isPDF()) {
$src = \Prints::getPDFLink($file->filepath);
}
} elseif ($file->isPDF()) {
$preview = \Prints::getPDFLink($file->filepath);
echo '
<iframe src="'.($preview ?: $link).'">
<a src="'.$link.'">'.tr('Il browser non supporta i contenuti iframe: clicca qui per raggiungere il file originale').'</a>
</iframe>';
} else {
echo '
<iframe src="'.base_path().'/view.php?file_id='.$file_id.'&download=1">
<a src="'.base_path().'/view.php?file_id='.$file_id.'&download=1">'.tr('Il browser non supporta i contenuti iframe: clicca qui per raggiungere il file originale').'</a>