codestates / codestates/Withyou

[✍️Dev Log] 윤대희 / 2021-11-25

Open
#127 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
0
Forks
3
PR merge metrics
No merged PRs in 30d

Description

## 오늘은 어떻게 프로젝트에 기여했나요?
- edit image 서버에 업로드 구현 (server/client)

## 오늘의 프로젝트에서 힘든 점은 무엇인가요?
- 이미존재하는 이미지 파일이 아니라 생성하는 이미지를 서버에 보내는 방법
-> 코드
const myImage = canvas.toDataURL("image/png");
let blobBin = atob(myImage.split(",")[1]); // base64 데이터 디코딩
let array = [];
for (let i = 0; i < blobBin.length; i++) {
array.push(blobBin.charCodeAt(i));
}
let blob = new Blob([new Uint8Array(array)], { type: "image/png" }); // Blob 생성
let file = new File([blob], "My card.png", {
type: "image/png",
});
let formData = new FormData(); // formData 생성
formData.append("img", file); // file data 추가
axios({
method: "PUT",
url: `${server_url}/mycard/post`,
data: formData,
headers: {
authorization: `Bearer ${accessTokenSession}`,
"content-type": "multipart/form-data boundary=something",
},
})
## 내일은 프로젝트에 기여하기 위해 무엇을 해야 하나요?
- [ ] 새페이지
- [ ] redo-undo

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.