-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: 이미지 업로드 압축 #267
Merged
Merged
feat: 이미지 업로드 압축 #267
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4007130
feat: 성우 관리 검색 추가 및 UI 개선
chanwukim 50ae803
chore: compressorjs dependencies 추가 #265
chanwukim c0f7478
feat: fileToWebPFile #265
chanwukim 085b54e
feat: imagedropzone 이미지 압축 적용
chanwukim 970af42
Merge branch 'develop' into feature/265
chanwukim d522266
fix: fileToWebPFile 최대높이로 변경
chanwukim File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/admins/features/animes/components/EditVoiceActorsModal.style.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import styled from "@emotion/styled"; | ||
|
||
export const HeaderTop = styled.div` | ||
display: flex; | ||
justify-content: space-between; | ||
width: 100%; | ||
`; | ||
|
||
export const HeaderBottom = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
margin-top: 0.5rem; | ||
width: 100%; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import Compressor from "compressorjs"; | ||
|
||
/** | ||
* 파일을 webP 포멧으로 변환합니다 | ||
* @param {File} file - 이미지 파일 | ||
* @param {number} quality - 변환후 이미지 품질 `기본 0.8` `0 ~ 8 사이 값` | ||
* @returns {Promise<File>} | ||
*/ | ||
export async function fileToWebPFile( | ||
file: File, | ||
quality: number = 0.8, | ||
): Promise<File> { | ||
return new Promise((resolve, reject) => { | ||
new Compressor(file, { | ||
quality, | ||
mimeType: "image/webp", | ||
maxWidth: 880, | ||
height: 620, | ||
success(result) { | ||
const webPFile = new File([result], file.name, { | ||
type: "image/webp", | ||
}); | ||
resolve(webPFile); | ||
}, | ||
error(err: Error) { | ||
console.error(err.message); | ||
reject(err); | ||
}, | ||
}); | ||
}); | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
만약 크기가 1200x800 이미지를 넣으면 880x620로 변환되는건가요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
엇 height는 무조건 고정으로 들어가겠네요
max로 할경우 변환돼요
height