Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've noticed some bizarre behaviour in my WordPress installation.

For some photos, when I click "Edit Image", the full image is not displayed to me - just the area visible in the thumbnail. And yet, if you click "View Image", you can see the full image is actually there.

Clearly needs some fixing

Clearly, some manual intervention is required for this pic's thumbnail.

Edit Image shows same weird crop

Click on edit image, only to find the whole image is not presented to me for cropping/editing. Has the image been cropped on upload, maybe?

The whole image is there

View attachment shows that no, the whole image is actually there - its just not available to me in the image editor.

What's going on?

This is only an issue for certain photos, and I can't see any difference between them - they are all JPGs, and there is no weird EXIF data that I can see... and yet some photos I can crop, and others not...

share|improve this question
    
Do a right-click -> view image over the image in the editing screen and see what the URL is. Maybe it's the 'large' size instead of 'full'. –  scribu Mar 10 '11 at 9:02
2  
Got any plugins installed? First line of attack when things get funky is to deactivate all plugins and see if that resolves the issue. –  TheDeadMedic Mar 14 '11 at 15:46
1  
try saving and then reedit the image. –  Bainternet Mar 18 '11 at 11:46
1  
Is the type of file a RGB image? I've seen weird things happen when CMYK or other format gets uploaded? –  Tom Mar 18 '11 at 13:25
1  
the crop image is also broken for me. But instead of it showing a cropped version no image loads at all. Only a problem on one site and all other sites seem to be fine (with same plugins) –  daniel Crabbe May 19 '11 at 14:20

4 Answers 4

Look in your theme files for:

add_image_size( 'thumb_name', some_number, 400, true );

Where thumb_name and some_number could be anything. Simply remove , true:

add_image_size( 'thumb_name', some_number, 400 );

Or if you need hard crop mode, change 400 to any other number (399 or 401 is fine)

add_image_size( 'thumb_name', some_number, 401, true );

I spent many hours researching this issue, and it's definitely a bug (even in WordPress 3.4.1). As kristi mentions, it occurs with images that are 400 pixels wide. It also occurs if your theme adds an image size with a height of 400 pixels and hard crop mode enabled. I've updated the bug report, and I hope it gets fixed soon!

share|improve this answer

I've created this simple function to get it.

function get_attachment_full_original($id){
    $img = pathinfo( get_attached_file($id) );
    $meta = get_post_meta($id, '_wp_attachment_backup_sizes', true);
    $orig = $meta['full-orig'];
    return str_replace(ABSPATH, get_bloginfo('url') . "/", path_join($img['dirname'], $orig['file']));
}
share|improve this answer

The same thing is happening to me. I found this page describing the same problem. It seems that it could be caused by the theme. Though changing the theme does not resolve the issue for me (and I have all my plugins disabled too).

I think this only happens on my images which are taller than they are wide ("portrait" orientation). If the image is wider than it is tall, it gets resized to fit correctly. Gotta be some bug in Wordpress's image resizing algorithm. grrr...

Annoying workaround: edit image and change the image size, adding "padding" to the sides so that the are wider than tall (if you're in Photoshop, change the canvas size, alt-ctrl-c). Then re-upload the image to wordpress.

Running Wordpress 3.2.1/ PHP 5.2.17 / twentyeleven theme / no plugins

Tried running the auto "Re-Install Wordpress" (clicked button on the Update tab), but it didn't change anything.


Could be something to do with the image size (tested with jpeg images):

  • Worked ok on a 500px x 1000px image
  • Failed on a 400px x 600px image
  • OK on a 500 x 600px image
  • Failed on a 400 x 800px image
  • OK on a 410 x 500px image
  • OK on a 401 x 500px image
  • Failed on a 400 x 500px image
  • OK on a 399 x 500px image
  • Failed on a 400 x 380px image

Seems to only fail when the image is exactly 400px wide


I filed a bug report for this. Hopefully the Wordpress devs can look at this.

share|improve this answer
3  
Yes, you're right about the 400px wide thing - its only 400px wide photos that fail for me too... That's quite weird... makes me think of the 500 mile email story: ibiblio.org/harris/500milemail.html –  Amanda Sep 28 '11 at 8:52
    
Off-topic but that's an incredible URL Amanda :) –  dunc Apr 16 '12 at 11:04


what you are describing here (cropped big size image in Edit Media screen) is a perfectly normal behavior when you use Apply changes to: All image sizes while cropping image and I believe the same thing could happen during upload when $crop param is set to true for all registered image sizes (similar to how add_image_size function works) As suggested above - deactivate image-related plugins and see what happens.

Anyway - the strangest thing is that there's no Restore Original Image button in your screenshot. This button is exactly what you need to work with the original size in editor.

See the update below...

I can replicate this only AFTER I crop the image but BEFORE i save it. The Restore Original Image button appears there as soon as I come back to edit it again after saving it.

See my screenshot: After saving it and coming back

This is apparently not a final answer, but it doesn't really fit the comment format so it ended up here...

UPDATE:
From looking at the source of image-edit.php it seems that a crucial role in decision whether to display the 'Restore..' link is a value of _wp_attachment_backup_sizes post meta field of a given attachment.

I would suggest checking that value for the problematic attachments. You can use something like this:

<pre>
<?php print_r( get_post_meta( $your_attachment_id_here, '_wp_attachment_backup_sizes', true ) ); ?>
</pre>

(or use the WordPress Console plugin)

Maybe you will find something odd there. Try also comparing these values between the broken and correctly displayed attachments... Again I know I'm not giving you the answer you'd like to hear but I believe this could be the right direction to investigate. Cheers

share|improve this answer
    
Answer updated... –  Michal Mau Mar 21 '11 at 23:05
    
Thanks for the ideas... still haven't sorted this problem out, but I appreciate your input –  Amanda Apr 13 '11 at 11:51
    
There is no "Restore Original Image" link because the image has not been cropped, so there is nothing to restore. Rather, it is wordpress incorrectly displaying the image (or inadvertently cropping the image somehow). –  kristi Sep 28 '11 at 0:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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