fedibird-fe/lib/paperclip/dimension_extractor.rb
noellabo fa82ec15d5 Add wide emoji support
Co-authored-by: Kei IWASAKI <laughk@users.noreply.github.com>
2023-03-01 20:23:57 +09:00

14 lines
419 B
Ruby

# frozen_string_literal: true
module Paperclip
class DimensionExtractor < Paperclip::Processor
def make
geometry = options.fetch(:file_geometry_parser).from_file(@file)
attachment.instance.width = geometry.width if attachment.instance.respond_to?(:width)
attachment.instance.height = geometry.height if attachment.instance.respond_to?(:height)
File.open(@file.path)
end
end
end