WordPress.org

Support

Support » Themes and Templates » [Resolved] Multiple featured image sizes

[Resolved] Multiple featured image sizes

  • I enabled featured images by adding the following to my functions.php file

    add_theme_support(‘post-thumbnails’);

    I need two different sizes of the featured image so I then added these two lines

    set_post_thumbnail_size(465, 310, TRUE);
    add_image_size(‘article-featured-size’, 655, 437, TRUE);

    When I am adding a post if I click “Set featured image” choose the file and then click “Use as featured image” the image is uploaded but only saved in it’s original size.

    I would be expecting the two sizes I set above.

    Any ideas on what I am doing wrong?

    Thanks

Viewing 8 replies - 1 through 8 (of 8 total)
  • The way you have enabled an additional image size is the correct one, so I don’t see what could go wrong here.

    When you say that you select a featured image for one of your posts, I assume you try uploading that image from your hard-drive (adding an image from start), not just selecting an image you have previously added when you didn’t have an additional size to your theme, right?

    Hi Jeremy,

    Thanks for the response.

    Yes I am uploading a new image from my hard-drive.

    I have deleted all the previous versions as well just to be sure I am looking at the correct one.

    Thanks

    Weird, I don’t know what could go wrong with your code here.

    Do the other image sizes get created (small, medium and large, as specified in Settings > Media)?
    If not, could you try with another theme, and then with all plugins deactivated, just to make sure that’s not related to one of your plugins?

    I disabled all of my plugins and then switched to the Twenty Eleven 1.2 theme.

    If I add a new image I only get the original sized image uploaded. No small, medium and large versions.

    is your image smaller than featured’s size?

    Hi Tim,

    Good suggestion, but unfortunately my image is larger than the two thumbnail sizes.

    I’ve been trying this on my localhost version. I’ve just checked on the live server, which is running identical code, and it works on there.

    I can’t see any reason why they would be different.

    If that’s a local environment issue, you migh want to make sure the GD library is installed on your local machine. WordPress uses it for the resizing.

    Thanks for all the help.

    I’ll check the GD library when I get back to work tomorrow.

    I’m pretty sure it is enabled as it’s normally something I use in sites.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Resolved] Multiple featured image sizes’ is closed to new replies.