WordPress.org

Make WordPress Core

Opened 6 years ago

Last modified 10 days ago

#32282 new defect (bug)

WordPress image cropping is buggy

Reported by: Jossnaz Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 4.2.2
Component: Media Keywords: has-patch
Focuses: administration Cc:

Description

see here

http://wordpress.stackexchange.com/questions/187577/cropping-image-results-in-image-being-too-small?noredirect=1#comment273421_187577

text copied from there:

This is the wordpress version 4.2.2 powell

I crop 1500 x 1000 and then press on crop, then save.

Resulting image size:

1497 x 1000

I don't know, I somehow hoped that wordpress is able to crop correctly.

The original image can be found here:

http://img.youtube.com/vi/zXgyoDAuaH0/maxresdefault.jpg

What I did is downsize to .... x 1000 then try to crop with selection manually entering 1500 x 1000

You can actually see the bug earlier, when you enter 1500 x 1000 and then click on the selection to drag it around (right, drag the selection, not change size) it results in the number 1500 falling down to 1498.

Attachments (1)

32282.diff (7.2 KB) - added by johnillo 10 days ago.

Download all attachments as: .zip

Change History (6)

#1 @rachelbaker
6 years ago

  • Focuses administration added
  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release

I successfully reproduced this bug using the latest trunk from 4.5 and the provided image. After manually setting a crop size of 1500x1000 the image size then changed to 1497x998 once I pressed the crop button, or tried to move the selection area.

https://cldup.com/-tX2uK8Tcp.png

#3 @desrosj
4 years ago

  • Summary changed from Wordpress image cropping is buggy to WordPress image cropping is buggy

@johnillo
10 days ago

#4 @Presskopp
10 days ago

  • Keywords has-patch added; needs-patch removed

#5 @johnillo
10 days ago

  • Crop the image in 100% scale to avoid rounding errors.
  • Don't recompute selection values when selection is dragged only.
  • Fix the issue where the selection values are off after the image is scaled down or restored.
  • Keep aspect ratio when holding the shift key.
Last edited 10 days ago by johnillo (previous) (diff)
Note: See TracTickets for help on using tickets.