DEV: Remove gifsicle dependency (#10357)

Dependency on gifsicle, allow_animated_avatars and allow_animated_thumbnails
site settings were all removed. Animated GIF images are still allowed, but
the generated optimized images are no longer animated for those (which were
used for avatars and thumbnails).

The added 'animated' is populated by extracting information using FastImage.
This field was used to selectively reoptimize old animations. This process
happens in the background.
This commit is contained in:
Bianca Nenciu
2020-10-16 13:41:27 +03:00
committed by GitHub
parent 14cb587b7e
commit 43e52a7dc1
16 changed files with 85 additions and 64 deletions

View File

@@ -78,7 +78,6 @@ class Upload < ActiveRecord::Base
def create_thumbnail!(width, height, opts = nil)
return unless SiteSetting.create_thumbnails?
opts ||= {}
opts[:allow_animation] = SiteSetting.allow_animated_thumbnails
if get_optimized_image(width, height, opts)
save(validate: false)
@@ -86,7 +85,9 @@ class Upload < ActiveRecord::Base
end
# this method attempts to correct old incorrect extensions
def get_optimized_image(width, height, opts)
def get_optimized_image(width, height, opts = nil)
opts ||= {}
if (!extension || extension.length == 0)
fix_image_extension
end
@@ -461,11 +462,12 @@ end
# secure :boolean default(FALSE), not null
# access_control_post_id :bigint
# original_sha1 :string
# verified :boolean
# verification_status :integer default(1), not null
# animated :boolean
#
# Indexes
#
# idx_uploads_on_verification_status (verification_status)
# index_uploads_on_access_control_post_id (access_control_post_id)
# index_uploads_on_etag (etag)
# index_uploads_on_extension (lower((extension)::text))