Non puoi selezionare più di 25 argomenti
Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
41 righe
1.3 KiB
41 righe
1.3 KiB
<?php |
|
|
|
$result = null; |
|
|
|
if (isset($mimetype)) { |
|
$element = [ |
|
'image/jpeg' => [ |
|
'html' => '<img style="max-width:100%; max-height:100%;" src="'.$relative_url.'">', |
|
'width' => '256px', |
|
'height' => '256px', |
|
'background' => 'url(\'/img/giphy.gif\')', |
|
], |
|
'video/mp4' => [ |
|
'html' => '<video controls autoplay loop data-setup="{}" width="256" height="256"> |
|
<source src="'.$relative_url.'" type="video/mp4" /> |
|
'. __("Il tuo browser non supporta HTML5 video tag. Prova ad aggiornare il tuo browser.") .' |
|
</video>', |
|
'width' => '256px', |
|
'height' => '256px', |
|
'background' => 'url(\'/img/giphy.gif\')', |
|
], |
|
'application/pdf' => [ |
|
'html' => '<embed src="'.$relative_url.'" type="application/pdf" width="100%" height="100%">', |
|
'width' => '500px', |
|
'height' => '500px', |
|
'background' => 'none', |
|
] |
|
]; |
|
|
|
if(isset($element[$mimetype])){ |
|
$result = $element[$mimetype]; |
|
} |
|
else |
|
{ |
|
$result = ['html' => __("Anteprima non disponibile"), 'width' => '200px', 'height' => '50px', 'background' => 'none']; |
|
} |
|
?> |
|
<div style="width:<?= $result['width'] ?>; height:<?= $result['height'] ?>; background: <?= $result['background'] ?>; background-repeat: no-repeat; display:table-cell; vertical-align:middle; text-align:center;"><?= $result['html'] ?></div> |
|
<?php |
|
} |
|
?>
|
|
|