Skip to content

Commit 8f6ec81

Browse files
committed
fix: move logic to premium
1 parent 7b064ad commit 8f6ec81

1 file changed

Lines changed: 5 additions & 19 deletions

File tree

src/shared/converters/image-converter.js

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@ const supportedFormats = [
1515
class ImageConverter extends Converter {
1616
static get mimeTypes() {
1717
// Accept all images supported by most browsers for conversion.
18-
return [
18+
return applyFilters( 'cimo.imageConverter.mimeTypes', [
1919
'image/jpeg',
2020
'image/png',
2121
'image/webp',
2222
'image/jpg',
23-
'image/heic',
24-
]
23+
] )
2524
}
2625

2726
static get showProgress() {
@@ -130,22 +129,9 @@ class ImageConverter extends Converter {
130129
maxDimension = parseFloat( maxDimension )
131130
}
132131

133-
// If file type is HEIC, convert first to PNG
134-
// then proceed to regular conversion
135-
if ( fileItem.file.type === 'image/heic' ) {
136-
const HEICConverter = applyFilters(
137-
'cimo.getHEICConverter',
138-
null,
139-
fileItem.file,
140-
{ format: 'png', quality: 1 }
141-
)
142-
143-
if ( ! HEICConverter ) {
144-
throw new Error( `HEIC converter is not found. HEIC conversion is only available in premium version.` )
145-
}
146-
147-
const optimizedResult = await HEICConverter.convert()
148-
fileItem.file = optimizedResult.file
132+
const modifiedFile = await applyFilters( 'cimo.convertImage.prepare', fileItem, outputFormat, options )
133+
if ( modifiedFile ) {
134+
fileItem.file = modifiedFile
149135
}
150136

151137
return new Promise( ( resolve, reject ) => {

0 commit comments

Comments
 (0)