• Resolved Fox Lee

    (@fox-lee)


    Hiya,

    I want to use Metaslider for a full-width slider with high quality images. My images are 1920px wide, to account for typical desktop resolution. However, I noticed that instead of displaying the full-size image, the slider code selects a smaller version of the image and scales up.

    On closer inspection, it appears that this is because the code for the image srcset includes (max-width: 1024px); if I change this in the browser (using the inspector) it selects the correct image and all is well.

    The various crop settings don’t fix this, nor does setting the slider to 100% width. It happens in Flex Slider and R. Slides. Nivo Slider displays the correct image, but it doesn’t play nice with my optimisation/lazy load plugin, so that isn’t a good solution.

    Is there a way I can override the output template to allow the full-size image to be used? I have full access to the site and no problem adding to theme code.

    • This topic was modified 5 years, 10 months ago by Fox Lee.

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

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi @fox-lee,

    When you disable cropping we hand off the sizing logic to WP. I believe if you need to add more sizes you just add it the WP way:

    add_image_size('my_larger_image', 1920, 700 );

    However, WP will use the main image you upload if an image size doesn’t exist. It appears to be using the full size image now.

    You might want to upload a much larger image and let WP serve the best one (some screens can easily be higher. MetaSlider supports the wp retina 2x plugin as well.

    If you enable cropping, we crop it based on the height and width of the setting you have at the top of the settings area. So if you set that to 1920px then it should crop to that.

    Let me know if that helps

    Thread Starter Fox Lee

    (@fox-lee)

    “WP will use the main image you upload if an image size doesn’t exist. It appears to be using the full size image now.”

    No, it’s using the 1024w generated size. That’s the whole problem. What makes you think it’s using the full size?

    I don’t believe I need to add an extra image size, because as you say, the full-size image should be returned if the generated sizes aren’t large enough. I need to figure out why that isn’t happening, not do a workaround with a larger image.

    I understand you’re saying that it’s handed off to WP in the case of no-cropping. However, it doesn’t matter whether I have cropping turned on or off. The slider uses the 1024w size on every possible crop setting (yes, I tried them all).

    “If you enable cropping, we crop it based on the height and width of the setting you have at the top of the settings area. So if you set that to 1920px then it should crop to that.”

    This is exactly what I did before contacting you. It’s using the 1024w size.

    Hi @fox-lee

    What indicates that it’s not using the full size image? On the network tab I only see that image being loaded. See here: https://prntscr.com/np6516

    Can you set it to crop and something like 1000×500 so I can take a look? If that is still showing the wrong image then I might have a better idea why. (you could make a new slideshow and put it on a test page if you dont want to affect the site)

    Thread Starter Fox Lee

    (@fox-lee)

    Thanks for your help. I see what you’re saying, it makes sens to think it must be the full-size version. However, if I isolate the image that’s actually displayed (by right-click > display image) I can see it’s only the 1024 version. It’s also evident if I use an inspector to change the sizes=”(max-width: 1024px) 100vw, 1024px” property of the srcset to sizes=”(max-width: 1920px) 100vw, 1024px” on the fly; it’s clear from the change in image quality that the intial image displayed is an upsized 1024w, not the full size version.

    Is this the not case when you check it? If it isn’t, perhaps it’s a browser-dependent issue.

    Here’s a screenshot of my network tab, showing that same image loaded in 1024×192: https://nonsense.munchlax.org/temp/fgc-metaslider-load.jpg

    You can see the full size version load as well, earlier in the sequence. But it’s the later one that’s being displayed, at least for me.

    Hi @fox-lee

    I’m not sure. I’m seeing the best image each time as far as I can tell. I just checked in Firefox as well. What happens if you put the image on the page without using MetaSlider?

    Also, try disabling all other plugins, even ones you think might have no effect.

    Thread Starter Fox Lee

    (@fox-lee)

    Hello again,

    Sorry for the delay, I was off work for a few days. I’ve looked into it further and it really does seem to be specific to Firefox; testing on other browsers and other computers, and having friends test it for me, it seems to always load the downsized version in FF and always load the proper version in Chrome. Are you completely certain you are seeing the full-sized version in Firefox?

    I’m seeing in the page source that max-width:1024px is there in both browsers, but it only seem to affect the displayed image in FF. Maybe the two browsers treat that condition differently?

    (For reference, the crop setting has been on Standard since before my last response. I have tried disabling every other plugin except Metaslider, but I’ve seen no changes.)

    • This reply was modified 5 years, 9 months ago by Fox Lee.
    Thread Starter Fox Lee

    (@fox-lee)

    Ah. I’ve got it.

    I’d forgotten that back in beta, I included code to modify MetaSlider’s output. I wasn’t happy with MS lacking srcset markup when cropping was turned on—autocropping is a great idea, but not if it means loading an oversized image on mobile—so I added it myself. And in that code, I made the mistake of calling “large” rather than “full” as my max size. I also needed to set my content width to a larger size.

    Why it would load full in Chrome (but not Firefox) regardless of that setting is… anyone’s guess, I suppose. I assume the two browsers just implement srcset differently. Obviously a complete red herring in this case :\

    In any case, I’ve modified my code and there are no problems now. Thanks for your help, and I do apologise for forgetting that I had added unexpected code to the scenario. I hope you’ll consider adding srcset markup natively in the future though <:)

    Hi @fox-lee

    Thanks for the follow up. That makes sense then. The srcset is built into MetaSlider but only when you disable cropping. I can’t remember exactly why I limited it to that but I think it was because it would require adding image sizes to WP and thus having WP crop every user image to those sizes. I’ll make a note to look into it again though.

    I’ll mark this as resolved.By the way, if you’re enjoying MetaSlider please leave us a 5-star review. They really help us out and let others find our plugin more easily. If you don’t think we deserve the 5 stars please let us know how we can improve, too. Thanks!

    https://www.ads-software.com/support/plugin/ml-slider/reviews#new-post

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Srcset capped at 1024’ is closed to new replies.