Fix #5065: .webp images upload support
Add ability to upload .webp images. Animated WebP images aren't supported. This is because they aren't supported by FFmpeg yet[1], so generating thumbnails and samples for them would be more complicated than for other formats. [1]: https://trac.ffmpeg.org/ticket/4907
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
class MediaAsset < ApplicationRecord
|
||||
class Error < StandardError; end
|
||||
|
||||
FILE_TYPES = %w[jpg png gif avif mp4 webm swf zip]
|
||||
FILE_TYPES = %w[jpg png gif webp avif mp4 webm swf zip]
|
||||
FILE_KEY_LENGTH = 9
|
||||
VARIANTS = %i[preview 180x180 360x360 720x720 sample original]
|
||||
MAX_FILE_SIZE = Danbooru.config.max_file_size.to_i
|
||||
@@ -372,7 +372,7 @@ class MediaAsset < ApplicationRecord
|
||||
|
||||
concerning :FileTypeMethods do
|
||||
def is_image?
|
||||
file_ext.in?(%w[jpg png gif avif])
|
||||
file_ext.in?(%w[jpg png gif webp avif])
|
||||
end
|
||||
|
||||
def is_static_image?
|
||||
|
||||
@@ -188,7 +188,7 @@ class Post < ApplicationRecord
|
||||
end
|
||||
|
||||
def is_image?
|
||||
file_ext =~ /jpg|gif|png|avif/i
|
||||
file_ext =~ /jpg|gif|png|webp|avif/i
|
||||
end
|
||||
|
||||
def is_flash?
|
||||
|
||||
Reference in New Issue
Block a user