Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#22779 closed defect (bug) (fixed)

Image dimensions rounding

Reported by: nacin Owned by: nacin
Milestone: 3.5 Priority: high
Severity: critical Version: 3.5
Component: Media Keywords: has-patch
Focuses: Cc:


Somehow the image editor is saving floats for dimensions, rather than rounding them according to the actual pixel dimensions of the image. These questions need to be answered before release:

  • Is this a regression from 3.4.2? Maybe having to do with the image editors?
  • If not a regression from 3.4.2, are we simply displaying it now without rounding them? I saw this in the attachment meta box, but does it exist in the media modal?

Attachments (3)

22779.png (24.9 KB) - added by koopersmith 8 years ago.
22779.diff (1.4 KB) - added by mikeschroder 8 years ago.
Round One.
22779.2.diff (1.6 KB) - added by mikeschroder 8 years ago.
Round Two. Fixes another instance of setting within crop, props @nacin.

Download all attachments as: .zip

Change History (11)

8 years ago

#1 @koopersmith
8 years ago

It shows up in the modal, as that's the data the image editor saves to the DB.

#2 @jorbin
8 years ago

I can confirm that it is a regression.

Last edited 8 years ago by jorbin (previous) (diff)

#3 @jorbin
8 years ago

Also, it's not just in the modal. It also happens in the non-modal image editor.

#4 @jorbin
8 years ago

in [22094] we changed stream_preview_image() and wp_save_image() to no longer use imagesx and imagesy which return int and now use WP_Image_Editor and it's get_size method.

#5 @nacin
8 years ago

  • Severity changed from normal to critical
  • Version set to trunk

8 years ago

Round One.

#6 @nacin
8 years ago

DH-Shredder in IRC:

This is the minimum (well, with additional sanity for update_size), and would restore us to what 3.4 did. We can do more casting or flooring, but I posted this initially because, well. We're right at the end, and I'd prefer to keep these sorts of changes as simple as possible. In particular, since we weren't doing any more with it previously.

"we weren't doing any more with it previously." — All I care about right now. Great.

8 years ago

Round Two. Fixes another instance of setting within crop, props @nacin.

#7 @koopersmith
8 years ago

  • Keywords has-patch added


#8 @nacin
8 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In 23103:

Image editors: After cropping, request new sizes from the image. If we rely on the values passed in, they may be floats. We must see what the image results in.

Cast in update_size() for sanity.

props DH-Shredder.
fixes #22779.

Note: See TracTickets for help on using tickets.