admin管理员组

文章数量:1327824

I've been trying to understand how WordPress picks images to use depending on the size of the user screen, but I've been unable to figure it out.

Is it just by checking if the request is coming from a mobile or desktop device? I have a photo site that would like to cater to 4k screens, so I have a featured images of 2400px * 1120px.

I know a version that has a width of 1536px is generated. On my mac, my the featured image is displayed as 1425px * 665px (1425px is the full width of my browser window). Why doesn't WordPress use the 1536px width image that was automatically generated instead of the 2400px width original?

I've been trying to understand how WordPress picks images to use depending on the size of the user screen, but I've been unable to figure it out.

Is it just by checking if the request is coming from a mobile or desktop device? I have a photo site that would like to cater to 4k screens, so I have a featured images of 2400px * 1120px.

I know a version that has a width of 1536px is generated. On my mac, my the featured image is displayed as 1425px * 665px (1425px is the full width of my browser window). Why doesn't WordPress use the 1536px width image that was automatically generated instead of the 2400px width original?

Share Improve this question edited Jul 29, 2020 at 17:28 Tom J Nowell 61k7 gold badges79 silver badges148 bronze badges asked Jul 29, 2020 at 16:58 OctaviaLoOctaviaLo 1398 bronze badges 3
  • Are you sure it was WordPress that decided this? There are image sizes yes, and those are chosen by the user, not WP, but there is also responsive images, in which case the browser is offered a selection and the browser decides based on local considerations. To answer the question, I'd need to know more about the context of this image, as well as the markup, etc. Also what's the native resolution of your panel? Are those 1425 logic pixels or physical pixels? Is it a high DPI panel? – Tom J Nowell Commented Jul 29, 2020 at 17:31
  • @TomJNowell I have a mac with retina display. I'm just wondering now maybe that is the reason why the large image is being used. Because although hovering over the element in dev tools tells me the width is 1425px, the display actually requires 1425*2 pixels in width (the native resolution is 2560 x 1600)...? – OctaviaLo Commented Jul 29, 2020 at 17:56
  • @TomJNowell Yep that was it. I discovered I can use chrome dev tools to simulate an MDPI screen and it did use the 1536px width image. Thanks for pointing me in the right direction :) – OctaviaLo Commented Jul 29, 2020 at 18:05
Add a comment  | 

1 Answer 1

Reset to default 1

It doesn't, WP supports responsive image markup, so your browser decides based on various factors such as pixel density, battery, network, viewport, etc

本文标签: post thumbnailsWhy doesn39t WordPress use the smaller sized image