Opened 6 months ago

Closed 6 months ago

#22779 closed defect (bug) (fixed)

Image dimensions rounding

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

Description

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

Download all attachments as: .zip

Change History (11)

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

I can confirm that it is a regression.

Last edited 6 months ago by jorbin (previous) (diff)

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

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.

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

Round One.

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.

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

  • Keywords has-patch added

+1

  • 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.