Make WordPress Core

Opened 3 years ago

Closed 3 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 3 years ago.
22779.diff (1.4 KB) - added by DH-Shredder 3 years ago.
Round One.
22779.2.diff (1.6 KB) - added by DH-Shredder 3 years ago.
Round Two. Fixes another instance of setting within crop, props @nacin.

Download all attachments as: .zip

Change History (11)

@koopersmith3 years ago

comment:1 @koopersmith3 years ago

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

comment:2 @jorbin3 years ago

I can confirm that it is a regression.

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

comment:3 @jorbin3 years ago

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

comment:4 @jorbin3 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.

comment:5 @nacin3 years ago

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

@DH-Shredder3 years ago

Round One.

comment:6 @nacin3 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.

@DH-Shredder3 years ago

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

comment:7 @koopersmith3 years ago

  • Keywords has-patch added


comment:8 @nacin3 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.