diff options
-rw-r--r-- | activestorage/CHANGELOG.md | 4 | ||||
-rw-r--r-- | activestorage/lib/active_storage/engine.rb | 2 | ||||
-rw-r--r-- | activestorage/test/fixtures/files/racecar.tif | bin | 0 -> 33705838 bytes | |||
-rw-r--r-- | activestorage/test/models/variant_test.rb | 11 |
4 files changed, 17 insertions, 0 deletions
diff --git a/activestorage/CHANGELOG.md b/activestorage/CHANGELOG.md index b643895893..cece15ff06 100644 --- a/activestorage/CHANGELOG.md +++ b/activestorage/CHANGELOG.md @@ -1,3 +1,7 @@ +* Permit generating variants of TIFF images. + + *Luciano Sousa* + * Use base36 (all lowercase) for all new Blob keys to prevent collisions and undefined behavior with case-insensitive filesystems and database indices. diff --git a/activestorage/lib/active_storage/engine.rb b/activestorage/lib/active_storage/engine.rb index b3bcf48d6f..e2e9b70b69 100644 --- a/activestorage/lib/active_storage/engine.rb +++ b/activestorage/lib/active_storage/engine.rb @@ -27,6 +27,7 @@ module ActiveStorage image/jpg image/jpeg image/pjpeg + image/tiff image/vnd.adobe.photoshop image/vnd.microsoft.icon ) @@ -49,6 +50,7 @@ module ActiveStorage image/gif image/jpg image/jpeg + image/tiff image/vnd.adobe.photoshop image/vnd.microsoft.icon application/pdf diff --git a/activestorage/test/fixtures/files/racecar.tif b/activestorage/test/fixtures/files/racecar.tif Binary files differnew file mode 100644 index 0000000000..0a11b22896 --- /dev/null +++ b/activestorage/test/fixtures/files/racecar.tif diff --git a/activestorage/test/models/variant_test.rb b/activestorage/test/models/variant_test.rb index 012aee3cc9..d98935eb9f 100644 --- a/activestorage/test/models/variant_test.rb +++ b/activestorage/test/models/variant_test.rb @@ -133,6 +133,17 @@ class ActiveStorage::VariantTest < ActiveSupport::TestCase assert_equal 20, image.height end + test "resized variation of TIFF blob" do + blob = create_file_blob(filename: "racecar.tif") + variant = blob.variant(resize: "50x50").processed + assert_match(/racecar\.png/, variant.service_url) + + image = read_image(variant) + assert_equal "PNG", image.type + assert_equal 50, image.width + assert_equal 33, image.height + end + test "optimized variation of GIF blob" do blob = create_file_blob(filename: "image.gif", content_type: "image/gif") |