Closed cogworks-infrastructure closed 1 year ago
Hi. I'm not sure that you actually want to do that 😉. Look at my sample picture profile for a Thumbnail image. Even though the picture width is always 150px, I specify that there should be two images, one 150px and one 300px. That way the browser can select the 300px image if the screen has a high pixel density. You define what the picture width is in different view-port widths, and then you define the image widths that should be available. Then its up to the browser to select the best image.
I've tried this code and get a slightly similar html code
Yes that is the correct behavior. 100w tells the browser that this is an image that is 100 pixels wide, and 200w tells the browser that this is an image that is 200 pixels wide. 150px tells the browser that the picture width always is 150px. The browser can now select which image it thinks fits the best. In your case it will always select the 200w image. But if you had had a 150w and 300w it probably would have selected 150w for a regular screen with pixel density 1x, and the 300w images for a mobile screen with pixel density 2x. There are a couple of links that explains the picture element more in the ReadMe.
thanks
Hi, We are trying to get an HTML response as below with your plugin but we couldn't create the "1x, 2x" sizes in source files with it Can you help us please
cc: @sekmenhuseyin