Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #1472041

    By inserting horizontal images of 1065*800 pixels, these are visible entirely on 1920*1080 or 1680*1050 desktop screens because the Content Area still has dimensions larger than the images themselves.
    The same result is obtained with vertical images 600*800.
    Reducing the screen size (for example to 1360*768), the horizontal images (1065*800) are automatically resized according to the width, so they fit on the screen even if you cannot see them in full because the new vertical size is slightly larger to the screen itself.
    However, in the case of vertical images, automatic resizing does not occur because the width of the images (600) is much smaller than the screen (1360).
    What parameter can I force or what code can I use to get vertical photos scaled by height instead of width, if that size is higher than the monitor size?

    #1472069

    Hey icarogioiosi,
    Typically, forcing a 600*800 image to 1360*768 will stretch the image, is this what you want?

    Best regards,
    Mike

    #1472084

    Hi Mike.
    I’ll try to explain using images.
    The first two show how the inserted images can be seen entirely on large screens (in this case 1680×1050).
    https://img.savvyify.com/image/1065×800-image-1680×1050-screen.9G3xM
    https://img.savvyify.com/image/600×800-image-1680×1050-screens.9GOfA

    The second two instead demonstrate how the images behave on smaller screens (in this case 1360×768).
    They are not visible in their entirety because the automatic scaling is probably calculated on the horizontal dimension and not on the vertical one.
    https://img.savvyify.com/image/1065×800-image-1360×768-screen.9GSb3
    https://img.savvyify.com/image/600×800-image-1360×768-screen.9GXUL

    I would like the 800 number to be read correctly in both cases, but especially for the vertical image.

    #1472092

    Hi,

    Thank you for the inquiry.

    Where can we check these images? Please provide the link to the page in question so that we can inspect the images. Have you tried applying a maximum height to the image?

    @media only screen and (max-width: 1366px) {
    	/* Add your Mobile Styles here */
    	.image {
    		max-height: 700px;
    	}
    }

    Adjust the “.image” selector accordingly.

    // https://kriesi.at/documentation/enfold/add-custom-css/#enable-custom-css-class-name-support

    Best regards,
    Ismael

    #1472178

    Hi Ismael.
    The code doesn’t seem to solve the problem.
    The site is under construction, therefore not visible because it is in maintenance mode.
    I created a WordPress user whose data I sent privately, as well as the link to the page from which I took the screenshots.

    #1472209

    Hey!

    Thank you for the inquiry.

    We were not able to edit the settings because the account above is not an admin. This should work for the first image in the portfolio, but it might slightly distort the image:

    .avia-image-container.av-m3m81k8l-37e2592474b1f3aa9f01e6b56eac1db5 img.avia_image {
        max-height: 600px;
    }

    If you want to apply this to specific images, try adding a Custom CSS Class name (e.g., av-limit-image-height) in Advanced > Developer Settings, then replace the css code with this:

    .av-limit-image-height img.avia_image {
        max-height: 600px;
    }

    For more info about css class names, please check this link: https://kriesi.at/documentation/enfold/add-custom-css/#enable-custom-css-class-name-support

    Regards,
    Ismael

    #1472262

    Hi Ismael.
    Thanks for your suggestions and your time.
    Obviously the first proposed code distorts the image and is not what I would like.
    Maybe it’s my fault, maybe I explained myself badly.
    I would like the images to resize while maintaining the proportions, as happens for example when looking at them on a smartphone: for example horizontal photos are visible in their entirety because they are automatically adapted to the screen, while maintaining the ratio between dimensions (e.g. 4:3 – 16:9).
    Furthermore, you advise me to set the Custom CSS Class name in Advanced > Developer Settings for each individual image, while I would like to force the automatic resizing system (especially for vertical images) which already works correctly in other situations.
    Also, how can I activate the Editor in Appearance? In my installation it is not visible

    #1472326

    Hi,

    for example horizontal photos are visible in their entirety because they are automatically adapted to the screen,

    Some images appear fully visible on mobile because their aspect ratio differs from the phone browser’s viewport. In portrait mode, the viewport is taller than most images with a landscape proportion, making them fully visible. Please note that images automatically adjust to occupy the space of their parent container. If you want to control how the images are resized and make them fully visible on certain screens with different aspect ratio, you need to apply a custom css class name to them and adjust their width or height manually. For example, you can set the image width to 50%, and the image will resize proportionally to its height.

    @media only screen and (max-width: 1366px) {
         /* Add your Mobile Styles here */
         .av-limit-image-height img.avia_image {
            width: 50%;
            margin: 0 auto;
        }
    }
    

    Again, you need to apply the class name “av-limit-image-height” to the Image element. However, focusing on whether the images are fully visible on load may not be necessary, as users can still scroll to view the content.

    Best regards,
    Ismael

    #1472349

    Hi Ismael.
    Thanks for your input. When there are hundreds of photos to manage, manually setting each individual image is a long task and can also lead to oversights and errors. I thought it was possible to control them all with a few lines of code rather than manually.
    The information to be inserted in the Style.css file is growing rapidly. Referring to your page https://kriesi.at/documentation/enfold/add-custom-css/#enable-custom-css-class-name-support , could you tell me how can I activate the Editor in Appearance? In my installation it is not visible

    https://img.savvyify.com/image/Immagine-2024-11-27-105508.9GnBf

    #1472405

    While waiting for a reply for the Editor and the automatic assignment to images instead of manual, I did a series of tests and the code that best solves my problem is the following, because the biggest problem is on vertical dimension:
    @media only screen and (max-height: 800px) {
    /* Add your Mobile Styles here */
    .av-limit-image-height img.avia_image {
    width: 80%;
    margin: 0 auto;
    }
    }
    On PC everything seems to work correctly, but on two Android smartphones that I tried with Samsung Internet and Chrome I do not understand why the images are scaled even though the screen resolution for both is 1080×2408 pixels.

    #1472424

    Hi,

    You don’t need to edit the functions.php file because the Custom CSS Class name field is already available in every element. However, if you need to enable the Appearance > Theme File Editor, make sure that the DISALLOW_FILE_EDIT directive in the wp-config.php file is set to true or is not present at all.

    I do not understand why the images are scaled even though the screen resolution for both is 1080×2408 pixels.

    Please note that the value (max-height: 800px) depends on the browser viewport size, not the screen resolution, which includes calculation for the device pixel ratio (DPR) or pixel density. For example, a phone with a screen resolution of 1024×2048px and a DPR of 3 will have a viewport size of approximately 360×802px.

    We recommend leaving the setup as it is since it would require a significant amount of modifications to account for all possible screen sizes. Making sure that the image is fully visible in the viewport might be unnecessary because users can still scroll to view the entire content.

    Best regards,
    Ismael

    #1472664

    Hi Ismael.
    I’ve done several tests and research and this is the code that solves my problem. I share it hoping can be useful to someone else.

    img {
    height: auto !important;
    max-width: 100% !important;
    width: auto !important;
    max-height: 100vh;
    }

    The only visible inconvenience is related to the images in the portfolio grids that are not aligned. I therefore created this class, assigning it to the portfolio grids in Advanced > Developer Settings.

    .standard_img img {
    height: 100% !important;
    max-width: 100% !important;
    width: 100% !important;
    max-height: 100% !important;
    }

    Thanks for your time.

    #1472666

    Hi,
    Glad to hear that you have this sorted out, and thanks for sharing your solution, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.

    Best regards,
    Mike

Viewing 13 posts - 1 through 13 (of 13 total)
  • The topic ‘automatic sizing of vertical images’ is closed to new replies.