Skip to content

Commit

Permalink
fix: 压缩后变大仍被上传
Browse files Browse the repository at this point in the history
  • Loading branch information
ATQQ committed Mar 14, 2024
1 parent b64ea19 commit e06e306
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/client/src/components/ImageUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ watch(files, async () => {
name: file.name || 'image',
file: fileRaw,
size: fileRaw?.size || 0,
originSize: fileRaw === file.raw? 0 : file.raw?.size,
originSize: fileRaw === file.raw ? 0 : file.raw?.size,
})
}).catch(err => {
ElMessage.error(err)
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/utils/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ interface CompressOptions {
height?: number
}
async function compressImage(file: File, ops: CompressOptions = {}) {
const { width, height, quality = 80, noCompressIfLarger } = ops
const { width, height, quality = 80, noCompressIfLarger = true } = ops
const isPng = await isPNG(file)
let newFile: File | null = null
if (isPng) {
Expand Down

0 comments on commit e06e306

Please sign in to comment.