fixed showing pdfs to download and not allowing in future
This commit is contained in:
@@ -212,10 +212,14 @@ $pagination_entity_name = "Adressen";
|
||||
</tr><tr>
|
||||
<th>Plan/Skizze</th>
|
||||
<td>
|
||||
<?php if($item->file && $item->file->file && $item->file->file->fileExists()): ?>
|
||||
<!--img src="<?=self::getUrl("File", "Download", ["id" => $item->file->file_id])?>" style="max-width: 480px;"/-->
|
||||
<img src="<?=$item->file->file->asDataUrl()?>" style="max-width: 480px;" />
|
||||
<?php endif; ?>
|
||||
<?php if($item->file && $item->file->file && $item->file->file->fileExists()):
|
||||
$dataUrl = $item->file->file->asDataUrl();
|
||||
if (str_contains($dataUrl, 'application/pdf')) {
|
||||
echo '<a href="' . $dataUrl . '" download="your-file-name.pdf" class="btn btn-primary" aria-label="Download PDF"><i class="fas fa-download"></i> Download PDF</a>';
|
||||
} else {
|
||||
echo '<img src="' . $dataUrl . '" style="max-width: 480px;" alt="File preview"/>';
|
||||
}
|
||||
endif; ?>
|
||||
</td>
|
||||
</tr><tr>
|
||||
<th></th>
|
||||
|
||||
Reference in New Issue
Block a user