I’m also hoping to add additional options for the Blog Hero pattern at the top of my home page (https://www.baristasandbartenders.com/).
]]>But when I use this image in a post using the image+ block. i.e. the one that says, “Add image with multiple customizations”
and inspect the srcset attribute, I only see two width specifications, 780w and 360w. Also, they both point to the same image, img.jpg
srcset="img.jpg ,img.jpg 780w, img.jpg 360w"
sizes="(max-width: 480px) 150px"
Irrespective of screen dimensions, it always loads img.jpg
. Why is this? Shouldn’t srcset show the other images and load the appropriate ones based on screen dimensions?
Surprisingly, this works fine when using just the image block (one that reads, “Insert an image to make a visual statement”).
]]>Any help will be appreciated.
]]>We would appreciate any help with changing the srcset of the site logo on this page: https://www.stezkaceskem.cz/
As you can see, the srcset includes “https://www.cestaceskem.cz/wp-content/uploads/2021/02/stezka-logo.png” which is an invalid location that causes problems for mobile users.
It does not help to delete and re-upload the same logo. It also does not help changing the link directly in the WP MySQL DB, in the table nmyr_options, option name theme_mods_zakra. Can someone please tell us the right approach to fix this?
Any help is greatly appreciated. Thanks in advance.
]]>To fix this I have to edit the file coblocks/dist/coblocks-1.js and add a class wp-image-id for thumbnails.
I tested it on the 3.1.5 version, but I use version 3.0.4, since the lightbox does not work in this version, as indicated in previous topics.
]]>Maybe I’m not understanding this correctly, but I thought this was supposed to determine the size of the viewport window, and load only the largest image necessary for that viewport? I’ve got this code in place, but any page speed test I run says the incorrect image size is being used for mobile devices. When I view the source code, I see srcset code, but only for the one size I’ve used in the code. Do I need to manually expand upon this? What I was thinking would happen is that if I have 6 image sizes setup (thumbnail, small, medium, medium_large, large, full) it would load the correct size for the viewport from those sizes.
I’ve setup an example page for testing https://delanopaddydayparade.com/test/ and here are my testing steps:
Basically, no matter what I do, page speed yells about the images being the wrong size. I’ve also tested page speed with only one image at a time, and it’s still marked as improperly sized. So I’m at a loss as to how this is actually supposed to work and if I build my sites “mobile first”, what size should I even be using? Because if I use the smaller sizes, the aren’t big enough for mobile. And if I use the larger sizes, they are too bog for mobile. Hopefully someone that sees this can explain it like I’m five.
Code used is below. Each example switches out the size obviously.
<?php
$image = get_field('sponsors_image');
$size = 'medium_large';
if( $image ) {
echo wp_get_attachment_image( $image, $size, '', array('class' => 'img-fluid border', 'loading' => 'lazy') );
} ?>
]]>Adaptive Images is theorized to read screen size of user, then serve image accordingly. So how does this plugin implement that?
Some background information:
So, if you are using breakpoints, why not
Plugin doesn’t work with CDN because plugin doesn’t change HTML to use breakpoint images. So, on first page load, CDN -> origin web server -> html (requests original image) -> cdn (stores original image) -> user. Then, user -> cdn -> user (always receives cdn-original-image).
Or alternatively, CDN receives an “adaptive image” once, then never changes it to avoid origin server.
So how does the plugin work and why not use srcset instead?
]]><figure class="wp-block-image size-full"><a href="https://..."><img decoding="async" width="344" height="110" src="https://....jpg" alt="" class="wp-image-64683"></a><figcaption class="wp-element-caption" style="cursor: pointer;">caption</figcaption></figure>
With Optimole enabled – even though I have it set to exclude, I am seeing no WordPress-generated srcset/sizes as before:
<figure class="wp-block-image size-full is-resized"><a href="https://...."><img decoding="async" loading="lazy" src="https://....jpg" alt="" class="wp-image-64680" width="716" height="225" srcset="..." sizes="(max-width: 716px) 100vw, 716px"></a></figure>
]]>