0
0
Fork 0

Support animated PNGs in media attachments (#28516)

This commit is contained in:
Christian Schmidt 2024-12-11 03:28:21 +01:00 committed by GitHub
parent 39364346bb
commit a70ae28644
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 123 additions and 183 deletions

View file

@ -23,7 +23,7 @@ module Paperclip
image = Vips::Image.thumbnail(@file.path, 100)
[image.width, image.height, image.colourspace(:srgb).extract_band(0, n: 3).to_a.flatten]
else
pixels = convert(':source -depth 8 RGB:-', source: File.expand_path(@file.path)).unpack('C*')
pixels = convert(':source -flatten -depth 8 -compress none RGB:-', source: File.expand_path(@file.path)).unpack('C*')
geometry = options.fetch(:file_geometry_parser).from_file(@file)
[geometry.width, geometry.height, pixels]
end