1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #36051 from yoones/active-storage-bmp-variants-support

Allow ActiveStorage to generate variants of BMP images
This commit is contained in:
George Claghorn 2019-04-21 16:05:33 -04:00 committed by GitHub
commit 142a8b97ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 0 deletions

View file

@ -1,3 +1,7 @@
* Permit generating variants of BMP images.
*Younes Serraj*
## Rails 6.0.0.beta3 (March 11, 2019) ##
* No changes.

View file

@ -33,6 +33,7 @@ module ActiveStorage
image/jpeg
image/pjpeg
image/tiff
image/bmp
image/vnd.adobe.photoshop
image/vnd.microsoft.icon
)
@ -56,6 +57,7 @@ module ActiveStorage
image/jpg
image/jpeg
image/tiff
image/bmp
image/vnd.adobe.photoshop
image/vnd.microsoft.icon
application/pdf

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View file

@ -144,6 +144,17 @@ class ActiveStorage::VariantTest < ActiveSupport::TestCase
assert_equal 33, image.height
end
test "resized variation of BMP blob" do
blob = create_file_blob(filename: "colors.bmp")
variant = blob.variant(resize: "15x15").processed
assert_match(/colors\.bmp/, variant.service_url)
image = read_image(variant)
assert_equal "BMP", image.type
assert_equal 15, image.width
assert_equal 8, image.height
end
test "optimized variation of GIF blob" do
blob = create_file_blob(filename: "image.gif", content_type: "image/gif")