WordPress.org

Make WordPress Core

Opened 22 months ago

Last modified 17 months ago

#21004 new defect (bug)

add_image_size hard crop messes up image editor rendering

Reported by: geniepop Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.4
Component: Media Keywords: has-patch
Focuses: Cc:

Description

When I add an image size with hard crop set to true ( ex: add_image_size('index-thumbnail', 420, 550, true); ) it makes it so that you cannot edit the full size of an image in the image editor - only a cropped version.

http://i47.tinypic.com/20h2dfr.png

(link to screenshot)

The left image in the screenshot is the editor when I removed 'true' from my add_image_size arguments. The right image is with 'true' added back in.

I also see that others had the same problem in this thread: http://wordpress.org/support/topic/help-add_image_size-and-image-cropping?replies=6

...but it was closed without any resolution.

Attachments (1)

21004.patch (594 bytes) - added by SergeyBiryukov 22 months ago.

Download all attachments as: .zip

Change History (3)

SergeyBiryukov22 months ago

comment:1 SergeyBiryukov22 months ago

  • Component changed from General to Media
  • Keywords has-patch added; needs-patch removed

Instead of the full size, stream_preview_image() loads the nearest image size that matches 400x400, apparently assuming that it will have the same proportions as the original, which is not the case here.

We could probably remove the size parameter to make it always load the original.

The resulting preview image should still be properly scaled later by _image_get_preview_ratio():
http://core.trac.wordpress.org/browser/tags/3.4/wp-admin/includes/image-edit.php#L364

Last edited 22 months ago by SergeyBiryukov (previous) (diff)
Note: See TracTickets for help on using tickets.