Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Morten 20 posts 132 karma points
    Dec 11, 2019 @ 20:48
    Morten
    0

    Background Image on sceens bigger than 1920

    Hi

    I found a problem with the background image at the top of "Blog Post List Page", "Content Page" and maybe other places.

    If you have a screen with a screen resolution higher than 1920, the image will start over, and not adapt to the screen. At the hero image at the frontpage, the image does adapt to the screen.

    The background image use this setting:

    GetCropUrl(width: 1920, height:600, upScale: true);
    

    and the hero image use this:

    GetCropUrl(imageCropMode: global::Umbraco.Web.Models.ImageCropMode.Max, upScale: true, width:1920, height:600)
    

    I've tried to use the same settings for the background image as the hero image uses, but it's not fixing the problem.

    Is it possible to fix this somehow?

    I can also see that it's the same problem on your own website: Screenshot from www.dot-see.com/en/blog/

  • Sotiris Filippidis 286 posts 1501 karma points
    Dec 12, 2019 @ 09:34
    Sotiris Filippidis
    0

    This is a known issue. It was not designed to go over 1920px from the start. I can't test right now, but what if you proportionally changed both width and height in the GetCropUrl call, e.g. 3840 x 1200? I know it's not a very elegant workaround.

    The only thing I can promise you is that the new upcoming version of the Umazel Starter Kit will feature dynamically generated responsive images with different original dimensions depending on viewport size, both for normal and background images. This will be an implementation based on the principles of these blog posts:

    https://www.dot-see.com/en/blog/responsive-background-images-in-umbraco-with-focal-point-preservation/ and https://www.dot-see.com/en/blog/responsive-images-with-srcset-and-image-cropper/

  • Morten 20 posts 132 karma points
    Dec 12, 2019 @ 16:27
    Morten
    100

    Yeah changing the size is not an elegant workaround, i tried that yesterday.

    My fix is that i changed the style of the background, and added background-repeat:no-repeat; background-size: 100%;, in this way the center of the bagground image will stay in the center of the screen, and it will always stretch out the image to match the screen. I personally think that its a better way to handle the problem that way.

    Old code and background:

                    <section class="inner-intro @smallIntroCss @overlayCss parallax parallax-background2" style="background:url(@bgImageUrl);">
    

    enter image description here New code and background:

                    <section class="inner-intro @smallIntroCss @overlayCss parallax parallax-background2" style="background:url(@bgImageUrl); background-repeat:no-repeat; background-size: 100%;">
    

    enter image description here

    I'm looking forward to see the upcoming version :)

Please Sign in or register to post replies

Write your reply to:

Draft