Add PDF first-page thumbnails via pdftoppm

Generated at upload time, stored alongside the PDF in data/pdfs/.
Shown in the file picker (48px) and component detail view (80px).
Gracefully skipped if pdftoppm is unavailable.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-22 00:40:43 +00:00
parent 61d52d8076
commit 451b04ad03
3 changed files with 54 additions and 2 deletions

View File

@@ -350,6 +350,14 @@ function render_detail_panel() {
const row = document.createElement('div');
row.className = 'detail-file-row';
if (pdf.thumb_filename) {
const thumb = document.createElement('img');
thumb.className = 'pdf-thumb';
thumb.src = `/pdf/${pdf.thumb_filename}`;
thumb.alt = '';
row.appendChild(thumb);
}
const a = document.createElement('a');
a.className = 'detail-file-link';
a.href = `/pdf/${pdf.filename}`;
@@ -1363,6 +1371,14 @@ function render_file_picker_list() {
const row = document.createElement('div');
row.className = 'fp-row';
if (pdf.thumb_filename) {
const thumb = document.createElement('img');
thumb.className = 'fp-thumb';
thumb.src = `/pdf/${pdf.thumb_filename}`;
thumb.alt = '';
row.appendChild(thumb);
}
const name_el = document.createElement('span');
name_el.className = 'fp-name';
name_el.textContent = pdf.display_name;