Why can’t I edit certain images from the WordPress Media library?

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…

4 Answers
4

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

Leave a Comment