0

When uploading new (or existing) images to the media library in Wordpress 3.6.1 the preview generated on the admin page/edit media page (eg. wp-admin/post.php?post=8736&action=edit ) is showing one of my custom image sizes defined from my functions file, rather than the default size.

I am using:

add_image_size( 'narrow', 205, 450, true );

In functions.php with after_setup_theme

This is an issue because this size is for part of the theme and is cropped so does not show the image as intended.

Question: Why is Wordpress choosing a custom image size on the editor and how can I force it to use a standard image size such as 'medium'.

Thanks

2
  • By chance are you doing anything that disables default image sizes or using plugin/theme that might do that as part of its functionality? Are standard sizes actually generated and available (as in files on disk) for your images?
    – Rarst
    Sep 24, 2013 at 20:03
  • No, not using any plugins at the moment. It is generating all the other images fine, I use Large, Medium and this Custom 'Narrow' size through the theme.
    – Alex
    Sep 25, 2013 at 16:56

1 Answer 1

0

It's actually a feature, not a bug! :)

WordPress will use (actually image_get_intermediate_size() function) a image already cropped if the width or the height matches the required dimension, and the required dimenssion for image editor is 900x450, EXACTLY your defined width.

A workaround will be to adjust your custom image size to 205 x 499 (a pixel smaller is enough)

OR to make the default medium size 450 by 450 ( not required to be square ).

2
  • Hi, I cannot change either Medium or the Custom 'Narrow' image size, i'm using them in my theme for exact dimensions. Is there any filter which can alter the media library image preview size?
    – Alex
    Sep 25, 2013 at 16:57
  • Nope, and I told you the problem is the way WordPress chooses the 'right' image for a given dimension. Sep 25, 2013 at 20:38

Your Answer

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

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