Files
wordpress-kratos-yang/.gitattributes
T
laoyang 1680ece73e 换主题缩略图,并把二进制文件锁进 .gitattributes
缩略图:原图是 2740x1424 的宽屏截图,主题缩略图要求 1200x900(4:3),
按中心裁切后缩放到 1200x900。裁掉的是左右各 421px。

另加 .gitattributes:本仓库 core.autocrlf=true,工作区 CRLF、仓库 LF。
这条规则对源码是对的,但二进制文件里天然含 0x0D 0x0A,一旦被当成文本
转换就当场损坏 —— PNG 会变成 file 判不出的 "data",getimagesize() 返回
false,WordPress 后台主题缩略图直接不显示。显式标 binary 后 git 不再动它们。

这次的损坏其实不是 git 干的,是打包脚本无差别 sed 's/\r$//' 造成的
(screenshot.png 少 3 个字节即 3 个 \r),脚本已同步修复。
2026-10-23 11:17:55 +08:00

26 lines
697 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 二进制文件禁止换行符转换
#
# 本仓库 core.autocrlf=true(工作区 CRLF、仓库 LF)。这条规则对源码是对的,
# 但二进制文件里天然含有 0x0D 0x0A 字节,一旦被当成文本转换就当场损坏:
# PNG 会变成 file 判不出的 "data",getimagesize() 返回 false,
# WordPress 后台主题缩略图直接不显示(已经踩过一次)。
#
# 显式标成 binary 后,git 不再对这些文件做任何 EOL 处理。
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.bmp binary
*.webp binary
*.woff binary
*.woff2 binary
*.ttf binary
*.otf binary
*.eot binary
*.zip binary
*.gz binary
*.pdf binary