Add support for libvips in addition to ImageMagick (#30090)
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
20e490ba7e
commit
5f15a892fa
16 changed files with 392 additions and 23 deletions
|
@ -10,7 +10,7 @@ class Admin::Metrics::Dimension::SoftwareVersionsDimension < Admin::Metrics::Dim
|
|||
protected
|
||||
|
||||
def perform_query
|
||||
[mastodon_version, ruby_version, postgresql_version, redis_version, elasticsearch_version].compact
|
||||
[mastodon_version, ruby_version, postgresql_version, redis_version, elasticsearch_version, libvips_version].compact
|
||||
end
|
||||
|
||||
def mastodon_version
|
||||
|
@ -71,6 +71,17 @@ class Admin::Metrics::Dimension::SoftwareVersionsDimension < Admin::Metrics::Dim
|
|||
nil
|
||||
end
|
||||
|
||||
def libvips_version
|
||||
return unless Rails.configuration.x.use_vips
|
||||
|
||||
{
|
||||
key: 'libvips',
|
||||
human_key: 'libvips',
|
||||
value: Vips.version_string,
|
||||
human_value: Vips.version_string,
|
||||
}
|
||||
end
|
||||
|
||||
def redis_info
|
||||
@redis_info ||= if redis.is_a?(Redis::Namespace)
|
||||
redis.redis.info
|
||||
|
|
|
@ -69,7 +69,7 @@ module Attachmentable
|
|||
original_extension = Paperclip::Interpolations.extension(attachment, :original)
|
||||
proper_extension = extensions_for_mime_type.first.to_s
|
||||
extension = extensions_for_mime_type.include?(original_extension) ? original_extension : proper_extension
|
||||
extension = 'jpeg' if extension == 'jpe'
|
||||
extension = 'jpeg' if ['jpe', 'jfif'].include?(extension)
|
||||
|
||||
extension
|
||||
end
|
||||
|
|
|
@ -57,7 +57,11 @@ class PreviewCard < ApplicationRecord
|
|||
has_one :trend, class_name: 'PreviewCardTrend', inverse_of: :preview_card, dependent: :destroy
|
||||
belongs_to :author_account, class_name: 'Account', optional: true
|
||||
|
||||
has_attached_file :image, processors: [:thumbnail, :blurhash_transcoder], styles: ->(f) { image_styles(f) }, convert_options: { all: '-quality 90 +profile "!icc,*" +set date:modify +set date:create +set date:timestamp' }, validate_media_type: false
|
||||
has_attached_file :image,
|
||||
processors: [Rails.configuration.x.use_vips ? :lazy_thumbnail : :thumbnail, :blurhash_transcoder],
|
||||
styles: ->(f) { image_styles(f) },
|
||||
convert_options: { all: '-quality 90 +profile "!icc,*" +set date:modify +set date:create +set date:timestamp' },
|
||||
validate_media_type: false
|
||||
|
||||
validates :url, presence: true, uniqueness: true, url: true
|
||||
validates_attachment_content_type :image, content_type: IMAGE_MIME_TYPES
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue