5

I can't seem to figure out why this dropdown is only showing "Full Size" as the option. I have the default "thumbnail", "medium", and "large" set in Settings, and I've also added a few custom sizes in my functions.php (using this method):

add_image_size( 'single-post-medium', 515 );
add_image_size( 'single-post-small', 250 );

Here's a screenshot of the area I'm speaking of:

enter image description here

It's in the pop up that appears when you click "Add Media" when editing a post.

I'm on Wordpress 4.1.5.

 

EDIT

My issue seemed to be that my thumbnails were not getting created. Images were uploading fine, but no other sizes were getting created. This turned out to be a local environment issue. First thing I did was set uploads folder to 777 recursively. That didn't work. Then I made sure GD was installed and active. It is, I see it when I dump phpInfo. Locally, my thumbnails are still not getting created. Not sure what the issue is there. But as soon as I moved my site to my dev server, the issue was resolved because the thumbnails were getting created.

11
  • Does this happen with every image you try to upload from the Add Media button? How about if you try it from the Media Library? And did this problem exist PRIOR TO your adding those custom image sizes?
    – Jeff Cohan
    Commented Jun 24, 2015 at 20:43
  • 1
    @JeffCohan yes it happened before as well, and it happens with every image.
    – Corey
    Commented Jun 24, 2015 at 20:48
  • Maybe upload a screen shot of your Media Settings dashboard?
    – Jeff Cohan
    Commented Jun 24, 2015 at 20:51
  • 1
    @JeffCohan Here you go: i.imgur.com/Bou3gqP.png. I also deactivated all of my plugins (this is a new install, wasn't that many plugins anyway), and it still persisted.
    – Corey
    Commented Jun 24, 2015 at 20:54
  • 1
    Also, inspect your upoads directories to see if there are, indeed, multiple versions of the images being created. For an image named "banner.png" which is larger in both dimensions than your "Large" size, there should be banner-300xnnn.png, banner-650xnnn.png, and banner-900xnnn.png.
    – Jeff Cohan
    Commented Jun 24, 2015 at 21:10

1 Answer 1

6

In order to show new image dimension options in the WordPress admin media library you would need to use the image_size_names_choose filter to assign them a name.

So the code in your functions.php should look something like this:

if ( function_exists( 'add_image_size' ) ) {
    add_image_size( 'single-post-medium', 515 );
    add_image_size( 'single-post-small', 250 );
}

add_filter( 'image_size_names_choose', 'my_custom_sizes' );

function my_custom_sizes( $sizes ) {
    return array_merge( $sizes, array(
        'single-post-medium' => __('Your Medium Size Name'),
        'single-post-small' => __('Your Small Size Name'),
    ) );
}

If they do not show right away, you may need to publish an image first and return to the media library and check again.

4
  • 1
    He's got a bigger problem, @M.Doye. The default sizes aren't showing up as selectable options, and he's not seeing different versions of his files in uploads. He's been using either "0" or "9999" as the max heights for Medium and Large. That, I'm quite sure, is his problem.
    – Jeff Cohan
    Commented Jun 24, 2015 at 21:23
  • 1
    Ah.. I see.. missed the comments while creating the answer. That sounds like it could be an issue. Could have something to do with the local set up. Would be interesting to see if the issue persists on a live server
    – Und3rTow
    Commented Jun 24, 2015 at 21:30
  • 1
    He and I took our comments to a chat. I now think the problem is that the GD Library isn't enabled. (He should at least be seeing thumbs in uploads, but he isn't. So it's probably not the zero or 9999 heights.)
    – Jeff Cohan
    Commented Jun 24, 2015 at 21:34
  • 1
    @M.Doye My issue doesn't exist on my dev server, so it is something local that is causing my thumbnails to not get created, even after GD is installed and active and uploads is set to 777. See my edit above.
    – Corey
    Commented Jun 24, 2015 at 23:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.