WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Multiple featured image sizes (9 posts)

  1. vertmonkee
    Member
    Posted 2 years ago #

    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

  2. Jeremy Herve
    Member
    Posted 2 years ago #

    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?

  3. vertmonkee
    Member
    Posted 2 years ago #

    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

  4. Jeremy Herve
    Member
    Posted 2 years ago #

    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?

  5. vertmonkee
    Member
    Posted 2 years ago #

    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.

  6. timDesain
    Member
    Posted 2 years ago #

    is your image smaller than featured's size?

  7. vertmonkee
    Member
    Posted 2 years ago #

    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.

  8. Jeremy Herve
    Member
    Posted 2 years ago #

    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.

  9. vertmonkee
    Member
    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.