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

[Feature/326] 서버에서 블러 이미지 처리하도록 수정 #431

Merged
merged 5 commits into from
Sep 19, 2024

Conversation

injoon2019
Copy link
Collaborator

@injoon2019 injoon2019 commented Sep 18, 2024

💡 이슈 번호

close: #326

✨ 작업 내용

서버에서 블러 이미지 처리하도록 수정

🚀 전달 사항

db에 blur_image_url 컬럼 추가는 해놨고, 어드민 api로 기존 유저들에도 blur_image_url이 생긴 후에, 내려주는 이미지 url을 변경할 예정입니다

Comment on lines 165 to 178
// fun makeBlurImage() {
// userProfileService.findAllWithImage().forEach {
// val imageFile = amazonS3FileService.download(it.imageUrl!!, System.getProperty("java.io.tmpdir"))
// val blurImage = imageProcessor.blurImage(imageFile)
// val key = makePathWithUserId(imageFile, it.user.id)
// amazonS3FileService.upload(blurImage, key)
// }
// }

fun makePathWithUserId(
file: MultipartFile,
userId: Long
) = "" + userId + FILE_NAME_DELIMITER + LocalDateTime.now()
.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")) + FILE_NAME_DELIMITER + file.originalFilename
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

요거 로컬에서 돌려서 기존 유저들 blurImage를 다 만들어서 주려해요. 궁금한게 원래 makePathWithUserId에서 블러이미지인지, 원본이미지인지 구분을 안해주었던가요??

Copy link
Member

Choose a reason for hiding this comment

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

그거 imageUploader에 33번째 줄에 있어요! 파일이름 앞에 blurred를 붙여주고 있어요!

Comment on lines +83 to +87
@ApiOperation("블러 이미지 생성")
@PostMapping("/blur-image")
fun makeBlurImage() {
adminFacade.makeBlurImage()
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

기존 회원들 blurImage 만들어줄 1회용 api입니다

Copy link
Member

Choose a reason for hiding this comment

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

한번 사용하고 제거하실건가요??

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

넵 맞아요!

  1. 이 PR 배포하면서 새로 회원가입하는 유저는 blurImage 등록
  2. 배포 후 어드민 API로 기존 회원들 blurImage 등록
  3. 그 후 어드민 API 제거

이렇게 할거 같아요

@injoon2019
Copy link
Collaborator Author

제 로컬 노트북이 윈도우인데, 파일 가져올때 윈도우여서 문제 되는 부분이 있네요. 로컬에서 테스트해보려했는데..

2024-09-18 18:04:29 [http-nio-8080-exec-1] [anonymous] WARN  c.n.b.a.g.e.GlobalExceptionHandler - Error occured at path: /api/v1/admin/blur-image, message: Illegal char <:> at index 22: original_2024-09-18T18:04:29.271942900153_20240823023939_filename.jpeg stackTrace: java.nio.file.InvalidPathException: Illegal char <:> at index 22: original_2024-09-18T18:04:29.271942900153_20240823023939_filename.jpeg
	at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParse

@miseongk
Copy link
Member

엇 그러면 제가 테스트 해볼까요?-?

@injoon2019
Copy link
Collaborator Author

오 네 한번만 해주세요!

@injoon2019 injoon2019 merged commit 2cfa9d0 into develop Sep 19, 2024
1 check passed
@injoon2019 injoon2019 deleted the feature/326 branch September 19, 2024 10:58
@injoon2019 injoon2019 self-assigned this Sep 19, 2024
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