Make WordPress Core

Opened 3 years ago

Closed 9 months ago

#21004 closed defect (bug) (fixed)

add_image_size hard crop messes up image editor rendering

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


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.


(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 3 years ago.

Download all attachments as: .zip

Change History (4)

#1 @SergeyBiryukov
3 years 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():

Last edited 3 years ago by SergeyBiryukov (previous) (diff)

#3 @wonderboymusic
9 months ago

  • Milestone changed from Awaiting Review to 3.5
  • Resolution set to fixed
  • Status changed from new to closed

Irrelevant since [22094].

Note: See TracTickets for help on using tickets.