WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 8 weeks 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:

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

Download all attachments as: .zip

Change History (4)

@SergeyBiryukov3 years ago

comment:1 @SergeyBiryukov3 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 would still be properly scaled to 400x400 by _image_get_preview_ratio():
http://core.trac.wordpress.org/browser/tags/3.4/wp-admin/includes/image-edit.php#L364

Version 0, edited 3 years ago by SergeyBiryukov (next)

comment:3 @wonderboymusic8 weeks 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.