-
Notifications
You must be signed in to change notification settings - Fork 3
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/#144 image compression #145
Conversation
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.
pubspec.lock์ ์์กด์ฑ ์ถ๊ฐํ๋ฉด์ ์๋์ผ๋ก ๋ณ๊ฒฝ๋ ํ์ผ ๊ฐ์๋ฐ, ์ผ๋จ ๋ชฐ๋ผ์ ๊ฐ์ด ์ฌ๋ ค์
@@ -732,8 +733,7 @@ class APIs { | |||
jwtToken = json.decode(jwtToken!)['data']['accessToken']; | |||
|
|||
// MultipartFile๋ก ๋ณํ | |||
|
|||
var profileImage = await http.MultipartFile.fromPath( | |||
var profileImage = await ImageUtil.compressImageToMultipartFile( |
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.
๊ธฐ์กด MultipartFile ๋ฐํ ๋ฉ์๋๋ฅผ ์์ ๊ฐ์ด๋ง ๋ณ๊ฒฝํด์ฃผ์๋ฉด ๋ฉ๋๋ค!
|
||
class ImageUtil { | ||
static Future<http.MultipartFile> compressImageToMultipartFile(String fieldName, String imagePath) async { | ||
const int maxSizeInBytes = 1 * 1000000; // 1MB |
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.
์๋ฒ์์ ๊ฐ๋ฅํ ์ต๋ ์ฌ์ด์ฆ์ธ๊ฐ์? ์๋๋ฉด ์์๋ก ์ ํ ๊ฐ์ธ๊ฐ์?
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.
์ต๋์ฌ์ด์ฆ๋ ์๋ง 2mb์ผ๊ฑด๋ฐ, ๋๋ถ๋ถ์ ํ์ผ์ด 1mb๋ฅผ ๋์ง์์๋ ์ถฉ๋ถํ ํํ์๋ ๋ฌธ์ ๊ฐ ์์๊ฑฐ๋ผ ํ๋จํ์ด์! ์ถํ ์์๊ฐ๋ง ์์ ํด์ฃผ์ ๋ ๋ฉ๋๋ค!
|
||
// ์ด๋ฏธ์ง ์์ถ ํจ์ | ||
Future<List<int>> compressImage(double quality) async { | ||
return (await FlutterImageCompress.compressWithFile( |
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.
FlutterImageCompress.compressWithFile ๋ฉ์๋์ ๋ฐํ ๊ฐ์ด ์ List์ผ๊น์..??
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.
์์ถ ๋ฉ์๋ ์์ฒด๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์์ฒด์์ ๋ฆฌ์คํธ๋ก ๋ฐํ ๋ฐ ์ฒ๋ฆฌํ์ง๋ง static์ผ๋ก ์ ์ธ๋ ๋ฉ์๋์ ๊ฒฝ์ฐ ๋ง์ง๋ง์ multipartFileํํ๋ก ๋ณํํ์ฌ ๋ฐํํ๋๋ก ๋์์ต๋๋ค!
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.
ํด๋ผ์ด์ธํธ์์ ์์ถ ์ฒ๋ฆฌ๋ฅผ ํด์ผํ๋ ๊ตฐ์! ํ์ธํ์ต๋๋ค ๐
๐คจ Motivation
๐ Key Changes
๐ To Reviewers