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

Optimize: image size #4

Merged
merged 2 commits into from
Oct 29, 2023
Merged

Optimize: image size #4

merged 2 commits into from
Oct 29, 2023

Conversation

heony704
Copy link
Owner

문제
이미지 파일 크기가 너무 커서 로드하는 데 많은 시간이 걸린다.

해결

  • 이미지 파일 크기를 화면에 표시된 너비의 두 배 크기로 줄임
    기존 총 34개의 파일 크기(jpg + png): 14.3MB
    크기 감소 후 총 34개의 파일 크기(jpg + png): 4.9MB (기존에 비해 약 66% 감소)
    포맷 변경 후 총 34개의 파일 크기(web): 1.1MB (기존에 비해 약 92% 감소)
  • jpg, png 대신 압축 효율이 더 좋은 webp 파일 사용
  • Picture 컴포넌트를 만들어서 webp 호환 가능한 브라우저는 webp 파일을, 그렇지 않은 브라우저는 jpg 혹은 png 파일을 로드하도록 함

추가

  • 이미지 파일들을 프로젝트 내부가 아닌 외부로 옮김
  • getImageSrc 함수를 통해 이미지 이름을 알면 이미지가 위치한 주소를 알 필요 없이 src를 만들어주도록 함

heony704 added 2 commits October 30, 2023 01:27
- 이미지 파일들을 프로젝트 내부가 아닌 외부로 옮김
- getImageSrc 함수를 통해 이미지 이름을 알면 이미지가 위치한 주소를 알 필요없이 src를 만들어주도록 함
- Picture 컴포넌트를 만들어서 webp 호환 가능한 브라우저는 webp 파일을, 그렇지 않은 브라우저는 jpg 혹은 png 파일을 로드하도록 함
@heony704 heony704 merged commit f70a9ec into main Oct 29, 2023
@heony704 heony704 deleted the optimize/imageSize branch October 29, 2023 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant