Skip to content
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

Merged
merged 2 commits into from
Sep 9, 2023
Merged

Feat/#144 image compression #145

merged 2 commits into from
Sep 9, 2023

Conversation

coke98
Copy link

@coke98 coke98 commented Sep 9, 2023

๐Ÿคจ Motivation

๐Ÿ”‘ Key Changes

  • ์ด๋ฏธ์ง€ ์••์ถ• ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•˜๋Š” ImageUtil ํด๋ž˜์Šค๋ฅผ ๋งŒ๋“ค๊ณ , compressImageToMultipartFile ๋ฉ”์„œ๋“œ๋ฅผ static์œผ๋กœ ๊ตฌํ˜„ํ–ˆ์Šต๋‹ˆ๋‹ค.

๐Ÿ™ To Reviewers

  • ์ด๋ฏธ์ง€ ์••์ถ• ๊ธฐ๋Šฅ์€ ์—ฌ๋Ÿฌ ํŽ˜์ด์ง€์—์„œ ํ™œ์šฉ์ด ๊ฐ€๋Šฅํ•˜๊ธฐ์— Util์ด๋ผ๋Š” ํด๋ž˜์Šค์™€ ๋””๋ ‰ํ† ๋ฆฌ๋กœ ๋”ฐ๋กœ ๋’€์Šต๋‹ˆ๋‹ค. ํŽธ์˜์— ๋”ฐ๋ผ์„œ ๋ฉ”์„œ๋“œ๋กœ ์ถ”์ถœํ•ด์„œ ์“ฐ์…”๋„ ๋˜๊ณ  ์–ผ๋งˆ๋“ ์ง€ ๋ณ€๊ฒฝํ•˜์…”๋„ ๋ฉ๋‹ˆ๋‹ค!
  • ํ˜„์žฌ ํ•ด๋‹น ๋ฉ”์„œ๋“œ๋ฅผ ํ”„๋กœํ•„ ๋ณ€๊ฒฝ API์—๋งŒ ์ ์šฉํ–ˆ๋Š”๋ฐ, ํ˜น์‹œ ๋ฌธ์ œ ์—†์œผ์‹œ๋ฉด ๋‹ค๋ฅธ ์ด๋ฏธ์ง€ ์—…๋กœ๋“œ๊ฐ€ ํ•„์š”ํ•œ ๋ถ€๋ถ„์— ์ ์šฉํ•ด์ฃผ์‹œ๋ฉด ๊ฐ์‚ฌํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.
  • ์„ค์ • > ํ”„๋กœํ•„ ๋ณ€๊ฒฝ ์‹œ
  • ํšŒ์›๊ฐ€์ž… > ํ”„๋กœํ•„ ์‚ฌ์ง„ ์—…๋กœ๋“œ ์‹œ
  • ์žฅํ„ฐ๊ฒŒ์‹œํŒ > ์ด๋ฏธ์ง€ ํŒŒ์ผ ์—…๋กœ๋“œ ์‹œ

@coke98 coke98 self-assigned this Sep 9, 2023
@coke98 coke98 changed the base branch from main to develop September 9, 2023 04:43
Copy link
Author

@coke98 coke98 left a 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(
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๊ธฐ์กด MultipartFile ๋ฐ˜ํ™˜ ๋ฉ”์„œ๋“œ๋ฅผ ์œ„์™€ ๊ฐ™์ด๋งŒ ๋ณ€๊ฒฝํ•ด์ฃผ์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค!

@coke98 coke98 changed the title Feat/#144 image compress Feat/#144 image compression Sep 9, 2023
@coke98 coke98 closed this Sep 9, 2023
@coke98 coke98 deleted the feat/#144_Image-compress branch September 9, 2023 04:52
@coke98 coke98 restored the feat/#144_Image-compress branch September 9, 2023 04:53
@coke98 coke98 reopened this Sep 9, 2023

class ImageUtil {
static Future<http.MultipartFile> compressImageToMultipartFile(String fieldName, String imagePath) async {
const int maxSizeInBytes = 1 * 1000000; // 1MB
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์„œ๋ฒ„์—์„œ ๊ฐ€๋Šฅํ•œ ์ตœ๋Œ€ ์‚ฌ์ด์ฆˆ์ธ๊ฐ€์š”? ์•„๋‹ˆ๋ฉด ์ž„์˜๋กœ ์ •ํ•œ ๊ฐ’์ธ๊ฐ€์š”?

Copy link
Author

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(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FlutterImageCompress.compressWithFile ๋ฉ”์†Œ๋“œ์˜ ๋ฐ˜ํ™˜ ๊ฐ’์ด ์™œ List์ผ๊นŒ์š”..??

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์••์ถ• ๋ฉ”์„œ๋“œ ์ž์ฒด๋Š” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์ž์ฒด์—์„œ ๋ฆฌ์ŠคํŠธ๋กœ ๋ฐ˜ํ™˜ ๋ฐ ์ฒ˜๋ฆฌํ•˜์ง€๋งŒ static์œผ๋กœ ์„ ์–ธ๋œ ๋ฉ”์„œ๋“œ์˜ ๊ฒฝ์šฐ ๋งˆ์ง€๋ง‰์— multipartFileํ˜•ํƒœ๋กœ ๋ณ€ํ™˜ํ•˜์—ฌ ๋ฐ˜ํ™˜ํ•˜๋„๋ก ๋‘์—ˆ์Šต๋‹ˆ๋‹ค!

Copy link
Contributor

@urlotus urlotus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ํด๋ผ์ด์–ธํŠธ์—์„œ ์••์ถ• ์ฒ˜๋ฆฌ๋ฅผ ํ•ด์•ผํ•˜๋Š” ๊ตฐ์š”! ํ™•์ธํ–ˆ์Šต๋‹ˆ๋‹ค ๐Ÿ‘

@urlotus urlotus merged commit 654705b into develop Sep 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants