• Resolved ludwigkeck

    (@ludwigkeck)


    On my “Latest” page there are ten instances of the DRP block Each block displays the post title and the featured image for one of my blogs.

    The featured image is typically a 2400 pixel wide photo and thus a rather large file. My page takes 20 to 25 seconds to load.

    Is it possible to have the block use one of the smaller auto-generated copies of the image?

    If the “Medium” size image (which has -300x… added to file name) were used, the needed file, typically 300 pixels wide, would be substantially smaller. For example the 2400 px uploaded file is 3.87 MB, the 300 px file is 33.03 KB. That is over a hundred times smaller. The load times would be significantly quicker.

    • This topic was modified 1 year, 6 months ago by ludwigkeck.
    • This topic was modified 1 year, 6 months ago by ludwigkeck.

    The page I need help with: [log in to see the link]

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Oliver Campion

    (@domainsupport)

    Hi,

    Hmm, I don’t think what you are requesting will be possible via the plugin.

    The reason is that the image URLs are provided by the third party website’s XML feed, not by the site the plugin resides on.

    So … the only way to do this would be to modify the third party website so that the featured image URLs provided in XML feeds are those of “medium” image size. I cannot see a plugin that does this, however.

    You may ask “But can’t you just modify the image URL to have -300×300 at the end of it?” and yes, you could but that would assume that this image size exists on the host server which it may well not (for whatever reason).

    Sorry if that’s not what you wanted to hear!

    Oliver

    Thread Starter ludwigkeck

    (@ludwigkeck)

    Thanks Oliver,

    It isn’t what I wanted to hear. I know that adding “-300×300” would not work as many of my medium size images are not square and there is, of course, no way to know what they are. The WordPress Reader seems to have a way. I imagine a rather complicated one that we can’t tie into.

    Maybe something will show up. Thanks again.

    Plugin Author Oliver Campion

    (@domainsupport)

    OK, here’s an example feed of yours … https://toolshed.cafeludwig.com/feed/

    The plugin actually looks through each post in the feed for an image to use as the “featured image” such as …

    <figure class="wp-block-image size-large"><img decoding="async" loading="lazy" width="750" height="563" src="https://i0.wp.com/toolshed.cafeludwig.com/wp-content/uploads/2023/03/LK230318-135809PATs1r16s.jpg?resize=750%2C563&ssl=1" alt="" class="wp-image-238" srcset="https://i0.wp.com/toolshed.cafeludwig.com/wp-content/uploads/2023/03/LK230318-135809PATs1r16s.jpg?resize=1024%2C768&amp;ssl=1 1024w, https://i0.wp.com/toolshed.cafeludwig.com/wp-content/uploads/2023/03/LK230318-135809PATs1r16s.jpg?resize=300%2C225&amp;ssl=1 300w, https://i0.wp.com/toolshed.cafeludwig.com/wp-content/uploads/2023/03/LK230318-135809PATs1r16s.jpg?resize=768%2C576&amp;ssl=1 768w, https://i0.wp.com/toolshed.cafeludwig.com/wp-content/uploads/2023/03/LK230318-135809PATs1r16s.jpg?resize=1536%2C1152&amp;ssl=1 1536w, https://i0.wp.com/toolshed.cafeludwig.com/wp-content/uploads/2023/03/LK230318-135809PATs1r16s.jpg?resize=1568%2C1176&amp;ssl=1 1568w, https://i0.wp.com/toolshed.cafeludwig.com/wp-content/uploads/2023/03/LK230318-135809PATs1r16s.jpg?w=1600&amp;ssl=1 1600w" sizes="(max-width: 750px) 100vw, 750px" data-recalc-dims="1" /><figcaption class="wp-element-caption">Azalea Blossoms</figcaption></figure>

    It then takes the src attribute as the URL of the featured image which in this case is https://i0.wp.com/toolshed.cafeludwig.com/wp-content/uploads/2023/03/LK230318-135809PATs1r16s.jpg?resize=750%2C563&ssl=1

    However, within the srcset attribute there are several alternative images such as this 300w url https://i0.wp.com/toolshed.cafeludwig.com/wp-content/uploads/2023/03/LK230318-135809PATs1r16s.jpg?resize=300%2C225&amp;ssl=1

    So. It may well be that we actually can do what you require with a setting similar to …

    Max Image Size: Full Size / 1024w / 300w / 768w / 1536w / 1568w / 1600w

    … shown as a drop down or with a numerical text box so the user can enter their desired max width in pixels?

    Do you think this should be a per block setting or a global setting?

    Oliver

    Thread Starter ludwigkeck

    (@ludwigkeck)

    Hey, thanks, Oliver,

    If you are willing to try it, do whichever is easier. I would think a global setting would be easiest for users.

    Ludwig

    Plugin Author Oliver Campion

    (@domainsupport)

    Agreed. I’ll start work on this after Easter.

    Oliver

    Thread Starter ludwigkeck

    (@ludwigkeck)

    Thank you, Oliver,

    Hope that it works out and doesn’t take too much of your time.

    Have a happy Easter!

    Ludwig

    Plugin Author Oliver Campion

    (@domainsupport)

    Hi Ludwig,

    I know this has taken ages and I really apologise. I’ve had a lot on my plate recently and going back to remembering how to program Blocks with React JavaScript really didn’t fill me with much delight haha!

    Anyway it’s done and you should find there are two new block controls, one to choose to open links in a new tab and another to set the maximum width of images which it tries to match to and if it can’t then it applies the next size up.

    You may need to wait for the cache to flush, though before you see this working or give it a blog URL that it’s not yet seen.

    Hope it works for you!

    Oliver

    Thread Starter ludwigkeck

    (@ludwigkeck)

    Hi Oliver,

    Thank you very much for all your efforts. I went in on the cafeludwig.com site and set all the options for 800 pixels max. All the blogs showed the featured images except two. Those two showed the topmost image, not the featured image. They are on page My Views – Cafe Ludwig. One is post AI Debugged | This ‘n That (wordpress.com). The other is FotoSketcher – Ludwig’s Toolshed (cafeludwig.com). I will wait for all the caches to get flushed and look a little more closely.

    Ludwig

    Plugin Author Oliver Campion

    (@domainsupport)

    Hi Ludwig,

    OK, so wordpress.com sites don’t give srcset data for the featured image, just a link to the one size. So in order to show an image of a different size the plugin looks through the post’s content for the first image with srcset data which it extracts accordingly.

    If such an image isn’t found then it reverts back to use the featured image for the post.

    Setting the Max Width value to “0” ensures that the featured image is always used.

    Oliver

    Thread Starter ludwigkeck

    (@ludwigkeck)

    Hello Oliver,

    I truly apologize for starting this topic. I should have known that diving into the depths of WordPress image handling would only lead to frustration and wasted time.

    You said, “wordpress.com sites don’t give?srcset?data for the featured image”. So I said, aha, I will help out and added this to the Toolshed post at the top:

    img src=”https://toolshed.cafeludwig.com/wp-content/uploads/2023/05/LK230501-185854PFSp11-2r16.jpg&#8221; hidden

    In the post the image does not show. That works. Your block should find that first and we’d be happy. Of course, it didn’t do a thing for your block.

    let’s toss in the towel and forget about images in WordPress. Their weird and strange ways will never allow users to control what happens.

    Plugin Author Oliver Campion

    (@domainsupport)

    Can you show me exactly what the hidden <img> tag looks like? Paste it into a “Code” block here please. I’ll see why it’s not picking that image up because it should.

    Thanks.

    Thread Starter ludwigkeck

    (@ludwigkeck)

    Hi Oliver,

    The contents I typed into the html block is:

    
    <img src="https://toolshed.cafeludwig.com/wp-content/uploads/2023/05/LK230501-185854PFSp11-2r16.jpg" hidden>
    
    

    What shows in the browser code is:

    
    <img decoding="async" src="https://i0.wp.com/toolshed.cafeludwig.com/wp-content/uploads/2023/05/LK230501-185854PFSp11-2r16.jpg?w=750&ssl=1" hidden data-recalc-dims="1">
    
    

    Note that there is the added WordPress generated subdomain i0.wp.com/ and other changes. It is not followed by srcset= as is the featured image prior and the logo image that follows.

    It just isn’t worth fighting WordPress and their weird ways.

    Plugin Author Oliver Campion

    (@domainsupport)

    OK, in that case I shall mark this topic as “resolved” seeing as we have resolved the original issue, if not exactly how you’d have preferred. Sorry!

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Can load speed be improved’ is closed to new replies.