diff options
Diffstat (limited to 'activestorage')
-rw-r--r-- | activestorage/lib/active_storage/previewer/video_previewer.rb | 5 | ||||
-rw-r--r-- | activestorage/test/models/preview_test.rb | 4 | ||||
-rw-r--r-- | activestorage/test/previewer/video_previewer_test.rb | 5 |
3 files changed, 7 insertions, 7 deletions
diff --git a/activestorage/lib/active_storage/previewer/video_previewer.rb b/activestorage/lib/active_storage/previewer/video_previewer.rb index 2f28a3d341..50e13d202a 100644 --- a/activestorage/lib/active_storage/previewer/video_previewer.rb +++ b/activestorage/lib/active_storage/previewer/video_previewer.rb @@ -9,15 +9,14 @@ module ActiveStorage def preview download_blob_to_tempfile do |input| draw_relevant_frame_from input do |output| - yield io: output, filename: "#{blob.filename.base}.png", content_type: "image/png" + yield io: output, filename: "#{blob.filename.base}.jpg", content_type: "image/jpeg" end end end private def draw_relevant_frame_from(file, &block) - draw ffmpeg_path, "-i", file.path, "-y", "-vcodec", "png", - "-vf", "thumbnail", "-vframes", "1", "-f", "image2", "-", &block + draw ffmpeg_path, "-i", file.path, "-y", "-vframes", "1", "-f", "image2", "-", &block end def ffmpeg_path diff --git a/activestorage/test/models/preview_test.rb b/activestorage/test/models/preview_test.rb index 55fdc228c8..e7ae399fb7 100644 --- a/activestorage/test/models/preview_test.rb +++ b/activestorage/test/models/preview_test.rb @@ -22,8 +22,8 @@ class ActiveStorage::PreviewTest < ActiveSupport::TestCase preview = blob.preview(resize: "640x280").processed assert_predicate preview.image, :attached? - assert_equal "video.png", preview.image.filename.to_s - assert_equal "image/png", preview.image.content_type + assert_equal "video.jpg", preview.image.filename.to_s + assert_equal "image/jpeg", preview.image.content_type image = read_image(preview.image) assert_equal 640, image.width diff --git a/activestorage/test/previewer/video_previewer_test.rb b/activestorage/test/previewer/video_previewer_test.rb index dba9b0d7e2..9dc350205b 100644 --- a/activestorage/test/previewer/video_previewer_test.rb +++ b/activestorage/test/previewer/video_previewer_test.rb @@ -12,12 +12,13 @@ class ActiveStorage::Previewer::VideoPreviewerTest < ActiveSupport::TestCase test "previewing an MP4 video" do ActiveStorage::Previewer::VideoPreviewer.new(@blob).preview do |attachable| - assert_equal "image/png", attachable[:content_type] - assert_equal "video.png", attachable[:filename] + assert_equal "image/jpeg", attachable[:content_type] + assert_equal "video.jpg", attachable[:filename] image = MiniMagick::Image.read(attachable[:io]) assert_equal 640, image.width assert_equal 480, image.height + assert_equal "image/jpeg", image.mime_type end end end |