Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ai-box
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
青山
ai-box
Commits
9fe8a7e8
Commit
9fe8a7e8
authored
Nov 14, 2024
by
fisherdaddy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: fix some bugs in ImageCompressor
parent
e47b8caf
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
32 deletions
+45
-32
ImageCompressor.jsx
src/components/ImageCompressor.jsx
+9
-4
tools.json
src/locales/en/tools.json
+10
-8
tools.json
src/locales/ja/tools.json
+11
-9
tools.json
src/locales/ko/tools.json
+12
-10
tools.json
src/locales/zh/tools.json
+3
-1
No files found.
src/components/ImageCompressor.jsx
View file @
9fe8a7e8
...
...
@@ -468,9 +468,10 @@ function ImageCompressor() {
const
handleCompress
=
async
()
=>
{
if
(
images
.
length
===
0
)
return
;
// 清除之前的压缩结果,允许重新压缩
setCompressedImages
([]);
for
(
const
image
of
images
)
{
if
(
compressedImages
.
find
(
img
=>
img
.
id
===
image
.
id
))
continue
;
setProcessing
(
prev
=>
({
...
prev
,
[
image
.
id
]:
0
}));
try
{
...
...
@@ -488,7 +489,8 @@ function ImageCompressor() {
preview
:
URL
.
createObjectURL
(
compressedFile
),
size
:
compressedFile
.
size
,
name
:
compressedFile
.
name
,
originalSize
:
image
.
size
originalSize
:
image
.
size
,
compressionSettings
:
{
...
settings
}
// 保存压缩时使用的设置
};
setCompressedImages
(
prev
=>
[...
prev
,
compressedImage
]);
...
...
@@ -638,7 +640,10 @@ function ImageCompressor() {
>
{
Object
.
keys
(
processing
).
length
>
0
?
t
(
'tools.imageCompressor.compressing'
)
:
t
(
'tools.imageCompressor.compress'
)
}
compressedImages
.
length
>
0
?
t
(
'tools.imageCompressor.recompress'
)
:
t
(
'tools.imageCompressor.compress'
)
}
</
Button
>
{
compressedImages
.
length
>
0
&&
(
...
...
src/locales/en/tools.json
View file @
9fe8a7e8
...
...
@@ -136,25 +136,27 @@
}
},
"imageCompressor"
:
{
"title"
:
"Image Compress
or
"
,
"description"
:
"
Compress images online
, supports batch processing"
,
"title"
:
"Image Compress
ion
"
,
"description"
:
"
Online image compression
, supports batch processing"
,
"dropzoneText"
:
"Click or drag images here (multiple selection supported)"
,
"quality"
:
"Compression Quality"
,
"maxSize"
:
"Max File Size"
,
"compress"
:
"Start Compression"
,
"compressing"
:
"Compressing..."
,
"download"
:
"Download Compressed Image"
,
"original"
:
"Original
Image
"
,
"compressed"
:
"Compressed
Image
"
,
"original"
:
"Original"
,
"compressed"
:
"Compressed"
,
"originalSize"
:
"Original Size"
,
"compressedSize"
:
"Compressed Size"
,
"savedSpace"
:
"Space Saved"
,
"filename"
:
"Filename"
,
"qualityTooltip"
:
"Set the compression quality
. Higher values give better image quality but larger file size.
"
,
"maxSizeTooltip"
:
"Set the maximum
file size after compression. If exceeded, the compression parameters will be adjusted automatically.
"
,
"qualityTooltip"
:
"Set the compression quality
; higher values result in better image quality but larger file sizes
"
,
"maxSizeTooltip"
:
"Set the maximum
size for compressed files; parameters will adjust automatically if exceeded
"
,
"downloadAll"
:
"Download All"
,
"clearAll"
:
"Clear All"
,
"maxImagesError"
:
"You can upload up to 10 images"
,
"maxImagesHint"
:
"Up to 10 images can be uploaded"
"maxImagesError"
:
"You can upload up to 10 images only"
,
"maxImagesHint"
:
"You can upload a maximum of 10 images"
,
"recompress"
:
"Recompress"
,
"compressionSettings"
:
"Compression Settings"
}
}
\ No newline at end of file
src/locales/ja/tools.json
View file @
9fe8a7e8
...
...
@@ -137,24 +137,26 @@
},
"imageCompressor"
:
{
"title"
:
"画像圧縮"
,
"description"
:
"オンライン
で画像を圧縮、バッチ処理
対応"
,
"dropzoneText"
:
"
ここに画像をクリックまたはドラッグ(複数選択対応
)"
,
"description"
:
"オンライン
画像圧縮、バッチ処理に
対応"
,
"dropzoneText"
:
"
クリックまたは画像をここにドラッグ(複数選択可
)"
,
"quality"
:
"圧縮品質"
,
"maxSize"
:
"最大ファイルサイズ"
,
"compress"
:
"圧縮開始"
,
"compressing"
:
"圧縮中..."
,
"download"
:
"圧縮後の画像をダウンロード"
,
"original"
:
"元
の
画像"
,
"compressed"
:
"圧縮
された画像
"
,
"original"
:
"元画像"
,
"compressed"
:
"圧縮
済み
"
,
"originalSize"
:
"元のサイズ"
,
"compressedSize"
:
"圧縮後のサイズ"
,
"savedSpace"
:
"節約
し
たスペース"
,
"savedSpace"
:
"節約
され
たスペース"
,
"filename"
:
"ファイル名"
,
"qualityTooltip"
:
"圧縮品質を設定します。
数値が高いほど画像品質が良くなりますが、ファイルサイズも大きくなります。
"
,
"maxSizeTooltip"
:
"圧縮後の最大ファイルサイズを設定します。このサイズを超える
と、圧縮パラメータが自動調整されます。
"
,
"qualityTooltip"
:
"圧縮品質を設定します。
値が高いほど画質が良くなり、ファイルサイズも大きくなります
"
,
"maxSizeTooltip"
:
"圧縮後の最大ファイルサイズを設定します。このサイズを超える
場合、自動的に調整されます
"
,
"downloadAll"
:
"すべてダウンロード"
,
"clearAll"
:
"すべてクリア"
,
"maxImagesError"
:
"最大10枚の画像をアップロードできます"
,
"maxImagesHint"
:
"最大10枚の画像がアップロード可能です"
"maxImagesError"
:
"最大10枚まで画像をアップロードできます"
,
"maxImagesHint"
:
"最大10枚の画像をアップロードできます"
,
"recompress"
:
"再圧縮"
,
"compressionSettings"
:
"圧縮設定"
}
}
\ No newline at end of file
src/locales/ko/tools.json
View file @
9fe8a7e8
...
...
@@ -138,24 +138,26 @@
},
"imageCompressor"
:
{
"title"
:
"이미지 압축"
,
"description"
:
"온라인
으로 이미지 압축, 일괄 처리 지원
"
,
"dropzoneText"
:
"
여기에 이미지를 클릭하거나 드래그하세요 (다중 선택 지원
)"
,
"description"
:
"온라인
이미지 압축, 일괄 처리를 지원합니다
"
,
"dropzoneText"
:
"
클릭하거나 이미지를 여기에 드래그하세요 (다중 선택 가능
)"
,
"quality"
:
"압축 품질"
,
"maxSize"
:
"최대 파일 크기"
,
"compress"
:
"압축 시작"
,
"compressing"
:
"압축 중..."
,
"download"
:
"압축된 이미지 다운로드"
,
"original"
:
"원본
이미지
"
,
"compressed"
:
"압축
된 이미지
"
,
"original"
:
"원본"
,
"compressed"
:
"압축
됨
"
,
"originalSize"
:
"원본 크기"
,
"compressedSize"
:
"압축 후 크기"
,
"savedSpace"
:
"절약된 공간"
,
"filename"
:
"파일명"
,
"qualityTooltip"
:
"압축 품질을 설정합니다. 값이 높을수록 이미지 품질이 좋아지지만, 파일 크기가 커집니다."
,
"maxSizeTooltip"
:
"압축 후 최대 파일 크기를 설정합니다. 이 크기를 초과하면 자동으로 압축 매개변수가 조정됩니다."
,
"downloadAll"
:
"전체 다운로드"
,
"clearAll"
:
"모두 삭제"
,
"maxImagesError"
:
"최대 10개의 이미지를 업로드할 수 있습니다"
,
"maxImagesHint"
:
"최대 10개의 이미지를 업로드할 수 있습니다"
"qualityTooltip"
:
"압축 품질을 설정합니다. 값이 높을수록 품질이 좋아지지만 파일 크기도 커집니다"
,
"maxSizeTooltip"
:
"압축 후 최대 파일 크기를 설정합니다. 이 크기를 초과하면 자동으로 조정됩니다"
,
"downloadAll"
:
"모두 다운로드"
,
"clearAll"
:
"모두 지우기"
,
"maxImagesError"
:
"최대 10개의 이미지만 업로드할 수 있습니다"
,
"maxImagesHint"
:
"최대 10개의 이미지를 업로드할 수 있습니다"
,
"recompress"
:
"재압축"
,
"compressionSettings"
:
"압축 설정"
}
}
\ No newline at end of file
src/locales/zh/tools.json
View file @
9fe8a7e8
...
...
@@ -154,6 +154,8 @@
"downloadAll"
:
"下载全部"
,
"clearAll"
:
"清除全部"
,
"maxImagesError"
:
"最多只能上传 10 张图片"
,
"maxImagesHint"
:
"最多可上传 10 张图片"
"maxImagesHint"
:
"最多可上传 10 张图片"
,
"recompress"
:
"重新压缩"
,
"compressionSettings"
:
"压缩设置"
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment