Support » Plugin: Recent Posts Widget With Thumbnails » image does not display in its original aspect ratio

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Martin Stehle

    (@hinjiriyo)

    I see that image in 100 x 30 px size.

    Hi Martin,

    The image you see has since been manually resized to 100 x 30, and uploaded, and then fixed with CSS:

    #rpwwt-recent-posts-widget-with-thumbnails-2 img.attachment-100×100 {
    display: block;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
    background: url(https://www.wascc.com.au/wp-content/uploads/2016/03/perth-supersprint-327.jpg) no-repeat;
    width: 327px;
    height: 100px;
    padding-left: 327px;
    }

    Cheers,
    Steve.

    Plugin Author Martin Stehle

    (@hinjiriyo)

    So I think the topic is resolved.

    Not really. 🙂

    If I make another post, and add a featured image, it will still not display properly on the front page, because it will display like this, despite the settings being like this.

    Hi.

    I’ve installed the plugin on a different website, and have the same issue, from the same settings.

    I can leave the thumbnail as is this time, as it is my website, not the clients.

    Help appreciated. 🙂

    Plugin Author Martin Stehle

    (@hinjiriyo)

    That is not a bug, but a WordPress standard behaviour. The plugin uses WP core functions to get the closest matching registered image size and uses it. And you see a cropped image, cropped to a square, which comes most close to the given size.

    If you would set the size bigger the whole image with its original aspect ratio would be displayed. It is a bit complex to explain, so let me jump into a solution: in the setup function or at the end of the file ‘functions.php‘ in the theme folder add a line like
    add_image_size( 'postlistthumb', 75, 75 );

    Take other numbers for width and height if desired. Use the code like add_image_size( name, width, height ).

    Go back to the widget and in the pulldown select the size ‘postlistthumb‘. That way you will see the not-cropped image in its original aspect ratio.

    Right. Martin, that’s great. I appreciate the solution.

    Plugin Author Martin Stehle

    (@hinjiriyo)

    Good to know: My solution only affects future uploaded images. If you want to get the effect also for existing images use the plugin “Regenerate Thumbnails” to get the old images in the new size. (After that you can deinstall that tool.)

    Okay. Thanks Martin.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘image does not display in its original aspect ratio’ is closed to new replies.