Add WebP support
This commit is contained in:
parent
28b9828f06
commit
752bd558ed
5 changed files with 5 additions and 5 deletions
|
@ -109,7 +109,7 @@ const loadImage = inputFile => new Promise((resolve, reject) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const getOrientation = (img, type = 'image/png') => new Promise(resolve => {
|
const getOrientation = (img, type = 'image/png') => new Promise(resolve => {
|
||||||
if (type !== 'image/jpeg') {
|
if (!['image/jpeg', 'image/webp'].includes(type)) {
|
||||||
resolve(1);
|
resolve(1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
module AccountAvatar
|
module AccountAvatar
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
IMAGE_MIME_TYPES = ['image/jpeg', 'image/png', 'image/gif'].freeze
|
IMAGE_MIME_TYPES = ['image/jpeg', 'image/png', 'image/gif', 'image/webp'].freeze
|
||||||
LIMIT = 2.megabytes
|
LIMIT = 2.megabytes
|
||||||
|
|
||||||
class_methods do
|
class_methods do
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
module AccountHeader
|
module AccountHeader
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
IMAGE_MIME_TYPES = ['image/jpeg', 'image/png', 'image/gif'].freeze
|
IMAGE_MIME_TYPES = ['image/jpeg', 'image/png', 'image/gif', 'image/webp'].freeze
|
||||||
LIMIT = 4.megabytes
|
LIMIT = 4.megabytes
|
||||||
MAX_PIXELS = 750_000 # 1500x500px
|
MAX_PIXELS = 750_000 # 1500x500px
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ class CustomEmoji < ApplicationRecord
|
||||||
:(#{SHORTCODE_RE_FRAGMENT}):
|
:(#{SHORTCODE_RE_FRAGMENT}):
|
||||||
(?=[^[:alnum:]:]|$)/x
|
(?=[^[:alnum:]:]|$)/x
|
||||||
|
|
||||||
IMAGE_MIME_TYPES = %w(image/png image/gif).freeze
|
IMAGE_MIME_TYPES = %w(image/png image/gif image/webp).freeze
|
||||||
|
|
||||||
belongs_to :category, class_name: 'CustomEmojiCategory', optional: true
|
belongs_to :category, class_name: 'CustomEmojiCategory', optional: true
|
||||||
has_one :local_counterpart, -> { where(domain: nil) }, class_name: 'CustomEmoji', primary_key: :shortcode, foreign_key: :shortcode
|
has_one :local_counterpart, -> { where(domain: nil) }, class_name: 'CustomEmoji', primary_key: :shortcode, foreign_key: :shortcode
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
class PreviewCard < ApplicationRecord
|
class PreviewCard < ApplicationRecord
|
||||||
IMAGE_MIME_TYPES = ['image/jpeg', 'image/png', 'image/gif'].freeze
|
IMAGE_MIME_TYPES = ['image/jpeg', 'image/png', 'image/gif', 'image/webp'].freeze
|
||||||
LIMIT = 1.megabytes
|
LIMIT = 1.megabytes
|
||||||
|
|
||||||
BLURHASH_OPTIONS = {
|
BLURHASH_OPTIONS = {
|
||||||
|
|
Loading…
Reference in a new issue