WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Full image is displayed instead of thumbnail

[Resolved] Full image is displayed instead of thumbnail

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author tepelstreel
    Participant

    @tepelstreel

    Hello,

    thanks for the compliments. It’s alway good to know, people like what you do. But I think I can’t reproduce your problem. Or I missunderstand.

    What the plugin does, is taking the featured image of a post, if there is no width given. As soon as you change the size of the image shown, will be counted upon display and the middle-sized image of the attached image of that post is taken and sized down.

    But it should be sized down. So if your thumbnails are 150px wide, there is actually no need to give a size in the widget.

    Do you have a URL for me? That I could check out, whether or not the plugin is behaving as it should.

    Cheers

    Kerfred
    Participant

    @kerfred

    When we upload an image, it automatically resizes it to several sizes: thumbnail, medium and large. When we attach an image as a thumbnail post, normally it uses the thumbnail size of this image.
    For example, my original image is named my_image.jpg. The thumbnail size is automatically named my_image-150×150.jpg.
    I think that it will be the best for your plugin if it uses the thumbnail size. You can use the get_the_post_thumbnail function:
    http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail
    with ‘thumbnail’ as the size parameter.

    Plugin Author tepelstreel
    Participant

    @tepelstreel

    I know that, but the thumbnails have to be resized from time to time. That’s what the users want. If you don’t want that and you want to fall back on the original thumbnail size, just leave the field for the width empty. And the plugin does the rest.

    Kerfred
    Participant

    @kerfred

    Even if the width field is empty, the thumbnail size is not taken. It always takes the full size of the image.
    To work for everyone, an idea would be to select the size of the image we want to take (thumbnail, medium, large or full). The actual behavior is always full.

    Kerfred
    Participant

    @kerfred

    To get the thumbnail with the thumbnail size, I did this modification.
    In FP_WidgetClass.php, I just replaced:
    $fpw_img_tag = get_the_post_thumbnail();
    by:
    $fpw_img_tag = get_the_post_thumbnail($post->ID, ‘thumbnail’);
    And that works.

    Plugin Author tepelstreel
    Participant

    @tepelstreel

    The function always did the job without parameters in my testing environments. Therefore, I never encountered your problem (and still don’t). I change most of my plugins at the moment anyway and will include your suggestion in the next run for the Featured Post Widget. Thanks a lot for your help.

    Kerfred
    Participant

    @kerfred

    To reproduce the problem:
    – Edit a post
    – Set a featured image (take a big image)
    – Use your widget with this post

    Plugin Author tepelstreel
    Participant

    @tepelstreel

    I cannot reproduce the problem: Since this is the way I work all the time. Even in my two live environments the problem never occours.

    But as said, I will implement your changes in all my plugins to make sure that the two or three people that have that problem AND tell me ebout it, get rid of it.

    Once again, thanks a lot for your help.

    Just FYI, I am experiencing the same problem as Kerfred. I will use his fix. Thanks Kerfred.

    For my particular purpose I made these changes below

    I added this to my functions.php

    if ( function_exists( ‘add_image_size’ ) ) {
    add_image_size( ‘feature-post-thumb’, 200, 9999 ); //300 pixels wide (and unlimited height)
    }

    In FP_WidgetClass.php I replaced

    $fpw_img_tag = get_the_post_thumbnail();

    with

    $fpw_img_tag = get_the_post_thumbnail($post->ID, ‘feature-post-thumb’);

    rjlhughes
    Member

    @rjlhughes

    I’m also having the same problem – and don’t want to edit php files – is there another workaround?

    Plugin Author tepelstreel
    Participant

    @tepelstreel

    Hello all,

    thanks for reporting these errors. I still can’t reproduce the above mentioned behaviour, but a solution might be near. I started the updating process for all plugins and I am making some changes to avoid full size images.

    The Featured Post Widget is about to be changed at the moment and gets some more functionality along with (hopefully) getting rid of having unwanted full size images.

    Unfortunately, I have a lot of work in my dayjob at the moment and I am a bit slow 😉

    Regards,
    Stefan

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘[Resolved] Full image is displayed instead of thumbnail’ is closed to new replies.