mirror of https://github.com/Siphonay/mastodon
Fix uploading higher-than-wide GIF profile picture with libvips enabled (#32911)
This commit is contained in:
parent
f65523c5b6
commit
cc5c125cc7
|
@ -52,6 +52,7 @@ module Paperclip
|
||||||
# implement. If cropping ever becomes necessary for other situations, this will
|
# implement. If cropping ever becomes necessary for other situations, this will
|
||||||
# need to be expanded.
|
# need to be expanded.
|
||||||
crop_width = crop_height = [target_width, target_height].min if @target_geometry&.square?
|
crop_width = crop_height = [target_width, target_height].min if @target_geometry&.square?
|
||||||
|
crop_width = crop_height = "'min(iw,ih)'" if crop_width == 'ih'
|
||||||
|
|
||||||
filter = begin
|
filter = begin
|
||||||
if @crop
|
if @crop
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 73 KiB |
|
@ -2,13 +2,20 @@
|
||||||
|
|
||||||
RSpec.shared_examples 'AccountAvatar' do |fabricator|
|
RSpec.shared_examples 'AccountAvatar' do |fabricator|
|
||||||
describe 'static avatars', :attachment_processing do
|
describe 'static avatars', :attachment_processing do
|
||||||
describe 'when GIF' do
|
describe 'with a square GIF' do
|
||||||
it 'creates a png static style' do
|
it 'creates a png static style' do
|
||||||
account = Fabricate(fabricator, avatar: attachment_fixture('avatar.gif'))
|
account = Fabricate(fabricator, avatar: attachment_fixture('avatar.gif'))
|
||||||
expect(account.avatar_static_url).to_not eq account.avatar_original_url
|
expect(account.avatar_static_url).to_not eq account.avatar_original_url
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'with a higher-than-wide GIF' do
|
||||||
|
it 'creates a png static style' do
|
||||||
|
account = Fabricate(fabricator, avatar: attachment_fixture('avatar-high.gif'))
|
||||||
|
expect(account.avatar_static_url).to_not eq account.avatar_original_url
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe 'when non-GIF' do
|
describe 'when non-GIF' do
|
||||||
it 'does not create extra static style' do
|
it 'does not create extra static style' do
|
||||||
account = Fabricate(fabricator, avatar: attachment_fixture('attachment.jpg'))
|
account = Fabricate(fabricator, avatar: attachment_fixture('attachment.jpg'))
|
||||||
|
|
Loading…
Reference in New Issue