Locally stored thumbnails for video and YouTube uploads

- Server-side video thumbnails: ffmpeg-static grabs a frame at ~1s,
  scales it to 480px and stores it under /uploads/thumbs/ at upload
  time (direct files, remote URLs and comment attachments)
- YouTube thumbnails are downloaded once at upload time instead of
  being hotlinked from i.ytimg.com on every render; remote URL kept
  as fallback for legacy rows
- thumbUrl now covers video/audio/youtube/twitch in grid meta,
  profile uploads and notifications
- Generated thumbnail files are removed on single/bulk delete

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
2026-10-04 03:06:01 +02:00
co-authored by Devin
parent d95ccf9dc7
commit cd04135463
7 changed files with 59 additions and 17 deletions
+2 -3
View File
@@ -25,9 +25,8 @@ export default defineEventHandler(async (event) => {
return rows.map((row) => {
const url = row.externalUrl ?? `/uploads/${row.fileName}`
const embedId = row.type === 'youtube' && row.externalUrl ? getYoutubeId(row.externalUrl) : null
const thumbUrl = row.type === 'youtube' && embedId
? youtubeThumbUrl(embedId)
: row.type === 'image' ? url : row.type === 'link' || row.type === 'twitch' || row.type === 'audio' ? row.previewImage : null
const thumbUrl = row.previewImage
?? (row.type === 'youtube' && embedId ? youtubeThumbUrl(embedId) : row.type === 'image' ? url : null)
return { id: row.id, thumbUrl }
})
})