@@ -48,6 +48,7 @@ async function save(file: DriveFile, path: string, name: string, type: string, h
48
48
if ( type === 'image/jpeg' ) ext = '.jpg' ;
49
49
if ( type === 'image/png' ) ext = '.png' ;
50
50
if ( type === 'image/webp' ) ext = '.webp' ;
51
+ if ( type === 'image/avif' ) ext = '.avif' ;
51
52
if ( type === 'image/apng' ) ext = '.apng' ;
52
53
if ( type === 'image/vnd.mozilla.apng' ) ext = '.apng' ;
53
54
}
@@ -171,7 +172,7 @@ export async function generateAlts(path: string, type: string, generateWeb: bool
171
172
}
172
173
}
173
174
174
- if ( ! [ 'image/jpeg' , 'image/png' , 'image/webp' , 'image/svg+xml' ] . includes ( type ) ) {
175
+ if ( ! [ 'image/jpeg' , 'image/png' , 'image/webp' , 'image/avif' , 'image/ svg+xml'] . includes ( type ) ) {
175
176
logger . debug ( 'web image and thumbnail not created (not an required file)' ) ;
176
177
return {
177
178
webpublic : null ,
@@ -196,7 +197,7 @@ export async function generateAlts(path: string, type: string, generateWeb: bool
196
197
}
197
198
198
199
satisfyWebpublic = ! ! (
199
- type !== 'image/svg+xml' && type !== 'image/webp' &&
200
+ type !== 'image/svg+xml' && type !== 'image/webp' && type !== 'image/avif' &&
200
201
! ( metadata . exif || metadata . iptc || metadata . xmp || metadata . tifftagPhotoshop ) &&
201
202
metadata . width && metadata . width <= 2048 &&
202
203
metadata . height && metadata . height <= 2048
@@ -216,7 +217,7 @@ export async function generateAlts(path: string, type: string, generateWeb: bool
216
217
logger . info ( 'creating web image' ) ;
217
218
218
219
try {
219
- if ( [ 'image/jpeg' , 'image/webp' ] . includes ( type ) ) {
220
+ if ( [ 'image/jpeg' , 'image/webp' , 'image/avif' ] . includes ( type ) ) {
220
221
webpublic = await convertSharpToJpeg ( img , 2048 , 2048 ) ;
221
222
} else if ( [ 'image/png' ] . includes ( type ) ) {
222
223
webpublic = await convertSharpToPng ( img , 2048 , 2048 ) ;
@@ -238,7 +239,7 @@ export async function generateAlts(path: string, type: string, generateWeb: bool
238
239
let thumbnail : IImage | null = null ;
239
240
240
241
try {
241
- if ( [ 'image/jpeg' , 'image/webp' , 'image/png' , 'image/svg+xml' ] . includes ( type ) ) {
242
+ if ( [ 'image/jpeg' , 'image/webp' , 'image/avif' , 'image/ png', 'image/svg+xml' ] . includes ( type ) ) {
242
243
thumbnail = await convertSharpToWebp ( img , 498 , 280 ) ;
243
244
} else {
244
245
logger . debug ( 'thumbnail not created (not an required file)' ) ;
0 commit comments