Site logo

[Support request] Image sizes on homepage too large

Home Forums Support [Support request] Image sizes on homepage too large

Home Forums Support Image sizes on homepage too large

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1878100
    Laura

    I am having trouble changing the container size on my homepage to match the size of the photos rather than the other way around. I do not want to resize the images to fit the aspect ratio they are currently at (369 × 308px). I want them to remain at the 600×500 that I have set them at but at the moment this means that the images are too large for the container and are causing issues with loading speed. The images are being pulled to the front page via wp-show posts if that makes a difference. Thanks

    #1878292
    David
    Staff
    Customer Support

    Hi there,

    in the WP Show Posts list, have you set the Width and Height attributes ? If you have them can you remove them. The WP Show Posts will output the src-set images for the browser to select from.

    This assumes you do have better size images that fit the requirements though.

    Let me know.

    #1879117
    Laura

    I have set the height and width because that’s the size I would like them to be on the homepage. Is there a better way to change these attributes so that they match the container size?

    #1879940
    Elvin
    Staff
    Customer Support

    Hi there,

    I have set the height and width because that’s the size I would like them to be on the homepage. Is there a better way to change these attributes so that they match the container size?

    You can keep the WPSP’s image height and width field empty and assign the sign through custom CSS.

    Example:

    /* size on desktop and small tablets */
    @media(min-width:769px){
    .wp-show-posts-image {
        height: 200px;
        width: 300px;
    }
    
    .wp-show-posts-image img {
        object-fit: cover;
    }
    }
    
    /* size on mobile */
    @media(max-width:768px){
    .wp-show-posts-image {
        height: 400px;
        width: 500px;
    }
    
    .wp-show-posts-image img {
        object-fit: cover;
    }
    }

    After this, you can consider registering new image sizes for mobile (if the default generated sizes are inadequate), and then regenerate the image for the newly registered image sizes.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.