Skip to content

Images Cut Off in the WordPress Image Editor

So, I’ve just spent the last half hour tracking down this annoying bug in WordPress 😛

I’m really glad I use an outdated theme (or at least one without custom header support) so I could track this puppy down.

I have been working on building a theme that is a child theme of good ‘ol 2010 (2011 wasn’t out when I started building :()

I uploaded a portrait image and noticed it got cut off in the image editor like so:

The editor’s will really need to be able to adjust that thumbnail image, so I went digging around and found that a theme called “Modfolio” had this exact same problem.  So, I figure, it’s gotta be something with the theme.  Especially since I didn’t get a whole lot of results…if it was a core issue and everyone was seeing this then I would assume there would be a lot more complaints.

I switched around from my child theme, to 2010, and even 2011, but the same error kept popping up :/  Then I figured I’d check it out in my blog here.  I’m currently using a slightly modified version of Uchilla theme – which hasn’t been updated in ages.  And lo-and-behold the image is coming up fine and dandy in the editor.  I could be wrong on this, but I believe the only file in a theme that can mess with the admin side of things is the functions.php file.  So I just kept hacking away at it until I found the bit of code that was causing me grief.

It’s lines 117 & 188 in the functions file for 2010:

define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyten_header_image_width', 940 ) );
define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'twentyten_header_image_height', 198 ) );

That was somehow adding a constraint to the editor preview and for me simply commenting out those two lines did the trick :)  I did have to re-upload all the affected images though…

I don’t know what effect that might have on the custom headers…I’m not using them myself so it wasn’t an issue for me.

Published inPHPScripting

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *