Opened 11 months ago
Last modified 5 months ago
#21004 new defect (bug)
add_image_size hard crop messes up image editor rendering
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Media | Version: | 3.4 |
| Severity: | normal | Keywords: | has-patch |
| 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)
Change History (3)
SergeyBiryukov — 11 months ago
comment:1
SergeyBiryukov — 11 months ago
- Component changed from General to Media
- Keywords has-patch added; needs-patch removed
comment:2
SergeyBiryukov — 5 months ago
Related: #17626

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