Implement image previewing #12

Merged
csimonis merged 7 commits from jank1619/file-explorer:feature/file-previews into main 2024-12-21 18:12:14 +00:00
2 changed files with 6 additions and 2 deletions
Showing only changes of commit 987e49cdec - Show all commits

View File

@ -26,7 +26,7 @@ readonly class DirContent
$fileInfo->getType() ?? 'N/A',
$fileInfo->getPath(),
$content,
mime_content_type($fileInfo->getFilename()),
mime_content_type($fileInfo->getPath() . '/' . $fileInfo->getFilename()),
);
}

View File

@ -15,7 +15,11 @@
</a>
<div class="mt-6 text-gray-700 overflow-auto max-h-96">
{% if file.mimeType starts with 'image' %}
<img src="{{ path('serve_file', {filePath: file.name}) }}" alt="">
{% else %}
<p class="whitespace-pre-wrap leading-relaxed break-all text-balance">{{ file.content|raw }}</p>
{% endif %}
</div>
</div>
{% endblock %}