admin管理员组文章数量:1423163
In case my recent questions have not made it abundantly clear, I am trying my hand at theme creation. Among the many other things that I am still figuring out are image sizes. Specifically add_image_size(...)
. I know I can use it to tell WordPress the sizes to make default images and so forth. Can I do that with an asset in my theme?
In my theme, I have an assets folder which contains a 1200x1200 image for use as a default in a range of cases. One part of my theme calls for images 140x140. Now, I could push that huge file into the src
for an image but it would be kinder on page load times if I resized it.
The do it myself hack would be to open GIMP and make one image for every size I can possibly imagine wanting.
Given I'm changing things all the time, I would rather let WordPress do that for me. Can I do that? If so how?
In case my recent questions have not made it abundantly clear, I am trying my hand at theme creation. Among the many other things that I am still figuring out are image sizes. Specifically add_image_size(...)
. I know I can use it to tell WordPress the sizes to make default images and so forth. Can I do that with an asset in my theme?
In my theme, I have an assets folder which contains a 1200x1200 image for use as a default in a range of cases. One part of my theme calls for images 140x140. Now, I could push that huge file into the src
for an image but it would be kinder on page load times if I resized it.
The do it myself hack would be to open GIMP and make one image for every size I can possibly imagine wanting.
Given I'm changing things all the time, I would rather let WordPress do that for me. Can I do that? If so how?
Share Improve this question asked Jul 1, 2019 at 3:19 Matthew Brown aka Lord MattMatthew Brown aka Lord Matt 1,0683 gold badges13 silver badges34 bronze badges1 Answer
Reset to default 0Images sizes are only relevant for uploads in the media library. If you have assets in your theme then you need to include whichever sizes are needed for how they're used in the theme.
Since end users can't choose your theme's bundled images to place wherever they want, you don't need every possible size. You'll only need the sizes that you use.
本文标签: mediaHow do I get WordPress to create resizes of a supplied default image in a theme
版权声明:本文标题:media - How do I get WordPress to create resizes of a supplied default image in a theme? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745355842a2655046.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论