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

#196: 회원가입에 이미지 업로드 추가해요 #200

Merged
merged 10 commits into from
Nov 13, 2024

Conversation

flash159483
Copy link
Contributor

1. 📄 관련된 이슈 및 소개

close #196

2. 🔥 변경된 점

회원가입시 이미지 업로드 기능을 추가해요

3. ✅ 필수 체크 사항

  • image Decoding해서 사이즈 조절
  • webp로 변환
  • 서버 업로드

4. 📸 작업물 사진 공유(선택)

5. 💡알게된 혹은 궁금한 사항

@flash159483 flash159483 added 🌱기능🌱 새로운 기능을 추가해요 ! 🍩브라우니🍩 24기 정승원 🔥리뷰 기다리는 중🔥 PR을 올리고 코드리뷰를 기다리고 있는 상태입니다. labels Nov 12, 2024
@flash159483 flash159483 self-assigned this Nov 12, 2024
@flash159483 flash159483 changed the base branch from develop to feature/flash159483/#191 November 12, 2024 13:38
Base automatically changed from feature/flash159483/#191 to develop November 13, 2024 11:12
Copy link
Member

@jeongjaino jeongjaino left a comment

Choose a reason for hiding this comment

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

야무져요 ? 왤케 빨리 찍어 야빠리 스고이다네 브라우니쨩

Comment on lines 5 to 8
@Serializable
data class ImageDto(
val url: String,
val imageUrl: String
Copy link
Member

Choose a reason for hiding this comment

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

ImageDto가 너무 통용적인 이름이지 않을까요?

PresignedUrlDto, ProfileImageUrlDto ... 생각하시기에 더 나은 네이밍이 있을까용 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ImageUrlDto로 갑니다 둘다 너무 도메인 specific함

Comment on lines +89 to +91
path("api/v1/image/presigned-url")
parameter("imageExtension", mimeType)
}
Copy link
Member

Choose a reason for hiding this comment

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

mimeType에 이미지 타입 jpg, png 같은걸 보내는 걸로 알고있는데요 !

imageExtension은 어떤 의미가 있어요 ? (진짜 궁금)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

서버로 보내는건데요 파일 링크 미리 생성하는데 필요한가봄 .jpg .webp 이런식으로

Comment on lines +119 to +121
sendWithoutRequest {
!it.url.host.endsWith("s3.ap-northeast-2.amazonaws.com")
}
Copy link
Member

Choose a reason for hiding this comment

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

해당 코드의 동작이 뭔가요 ??

GPT가 아래라고 설명하긴 했는데요, I 궁금
이와 같은 조건은 AWS S3와 같은 특정 호스트로만 요청을 허용하고 나머지 요청은 무시하거나 제한하는 데 사용될 수 있습니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

S3를 호출할때 token 들어가면 안되서용

Comment on lines 17 to 21
override suspend fun decodeImage(imagePath: String): String {
val uri = Uri.parse(imagePath)

return resizeAndConvertToWebp(context, uri)
}
Copy link
Member

Choose a reason for hiding this comment

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

사진 로드 압축, 타입 변환 꽤 무거운 작업으로 보이는데요

Default Dispather를 사용하는건 어떨까요 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ioDispatcher로 바꿨어용

Comment on lines +57 to +65

FileOutputStream(outputFile).use { outputStream ->
if (!resizedBitmap.compress(Bitmap.CompressFormat.WEBP, 80, outputStream)) {
throw ImageUploadFailedException.ImageDecodeFailedException(
"Failed to compress bitmap to WebP format."
)
}
outputStream.flush()
}
Copy link
Member

Choose a reason for hiding this comment

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

비트맵 리소스 함수 중 메모리 환원하는 recycle()이 있는데요,

FileOutputStream 밑에 resizedBitmap.recycle() 호출하는 건 어떨까요 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

바로 하냐 나중에 자동으로 하냐 차이라서 없어도 무방한데요

@flash159483 flash159483 merged commit 86ee0fa into develop Nov 13, 2024
2 checks passed
@flash159483 flash159483 deleted the feature/flash159483/#196 branch November 13, 2024 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌱기능🌱 새로운 기능을 추가해요 ! 🍩브라우니🍩 24기 정승원 🔥리뷰 기다리는 중🔥 PR을 올리고 코드리뷰를 기다리고 있는 상태입니다.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WS-439 [FEATURE]: 이미지 업로드 서버 연동
2 participants