Skip to content

Commit

Permalink
fix(image): ignore compressor in gif mimetype
Browse files Browse the repository at this point in the history
  • Loading branch information
Novout committed Mar 31, 2023
1 parent 279d710 commit 4ddef4e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/better-write-image-converter/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,17 @@ export const getImageFileRaw = (
_.type = 'file'
_.accept = options?.accept || '.png, .svg, .jpg, .jpeg'
_.addEventListener('change', async function () {
const file = (this.files as any)[0]
const files = this.files

if (!file) return
if (!files || files.length === 0) {
rej()

return
}

const file = files[0]

if (options?.compress?.value) {
if (options?.compress?.value && file.type !== 'image/gif') {
new Compressor(file, {
quality: options?.compress?.quality ?? 1.0,
async success(compressed) {
Expand Down

0 comments on commit 4ddef4e

Please sign in to comment.