FEATURE: Show video thumbnail in composer (#27233)

When uploading a video, the composer will now show a thumbnail image in
the composer preview instead of just the video placeholder image.

If `enable_diffhtml_preview` is enabled the video will be rendered in
the composer preview and is playable.
This commit is contained in:
Blake Erickson
2024-05-29 08:24:29 -06:00
committed by GitHub
parent 96305ec9a6
commit f292e645b9
4 changed files with 62 additions and 3 deletions

View File

@ -44,6 +44,10 @@ module PrettyText
urls.each do |url|
sha1 = Upload.sha1_from_short_url(url)
if (url.split(".")[1].nil?) # video sha1 without extension for thumbnail
thumbnail = Upload.where("original_filename LIKE ?", "#{sha1}.%").last
sha1 = thumbnail.sha1 if thumbnail
end
map[url] = sha1 if sha1
end