mirror of
https://github.com/discourse/discourse.git
synced 2025-05-25 00:32:52 +08:00
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:
@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user