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: add a script to automaticly compress image #9

Merged
merged 6 commits into from
Nov 20, 2023

Conversation

SigureMo
Copy link
Collaborator

@SigureMo SigureMo commented Nov 4, 2023

This PR resolves #5

当图片大小大于某个阈值(当前为 300KiB)时自动压缩图片,压缩后文件使用 WebP 格式,并将原文中图片链接一键替换

由于将其作为 hook 直接修改可能会丢失掉原来的图片,因此改为手动执行

# Compress all images in images/xian-event
pnpm img:compress xian-event
# Compress all images in images
pnpm img:compress

@SigureMo SigureMo marked this pull request as draft November 4, 2023 16:07
Copy link

netlify bot commented Nov 17, 2023

Deploy Preview for pfccblog ready!

Name Link
🔨 Latest commit 13148b7
🔍 Latest deploy log https://app.netlify.com/sites/pfccblog/deploys/655a4bca920de900084b1849
😎 Deploy Preview https://deploy-preview-9--pfccblog.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@SigureMo SigureMo marked this pull request as ready for review November 19, 2023 17:47
@SigureMo SigureMo enabled auto-merge November 19, 2023 17:51
Copy link
Contributor

@sunzhongkai588 sunzhongkai588 left a comment

Choose a reason for hiding this comment

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

虽然我看不懂,但是牛哇!话说应该只是改图片质量不改尺寸吧

@SigureMo SigureMo added this pull request to the merge queue Nov 20, 2023
Merged via the queue into main with commit a8c8120 Nov 20, 2023
6 checks passed
@SigureMo SigureMo deleted the auto-compress-image branch November 20, 2023 13:45
@SigureMo
Copy link
Collaborator Author

虽然我看不懂,但是牛哇!话说应该只是改图片质量不改尺寸吧

改,如果图片宽度过高(> 1000px)会降低宽度,因为设备上不可能有这么宽的空间用于显示图片,本来也会缩放,所以大图没意义

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.

[Feature Request] 图片压缩
2 participants