【发布时间】:2016-02-17 13:27:42
【问题描述】:
我遇到了一个问题,即 wordpress 在一篇博文中不断调整特色图片的大小。
下面是它输出的 html 示例:
the_post_thumbnail('large');
<img width="1900" height="849" src="http://127.0.0.1/wp-content/uploads/2016/02/MyImage-1903x850.png" class="attachment-large size-large wp-post-image" alt="MyImage-1903x850" srcset="http://127.0.0.1/wp-content/uploads/2016/02/MyImage-600x268.png 600w, http://127.0.0.1/wp-content/uploads/2016/02/MyImage-1903x850.png 1903w" sizes="(max-width: 1900px) 100vw, 1900px">
如您所见,实际图片尺寸为 1903x850。但是,wordpress 决定在 1900x849 的 img 标签中添加不同的宽度/高度
我尝试使用 regen 缩略图并重新上传图像,但似乎无法弄清楚为什么会发生这种情况,这真的很奇怪。
【问题讨论】:
-
图像正在缩小,因为当图像实际为 1903 像素时,最大宽度设置为“1900 像素”。
-
是的,我看到了。我的模板中有一个地方将模板的最大宽度设置为 1900,而我使用的是 1903 - 男生错误 - 感谢您的帮助 :)
标签: wordpress image dimensions