WordPress.org

Make WordPress Core

#22597 closed defect (bug) (fixed)

Image Editor checking GD directly for rotate support

Reported by: DH-Shredder Owned by: ryan
Milestone: 3.5 Priority: normal
Severity: normal Version: 3.5
Component: Media Keywords: has-patch commit
Focuses: Cc:

Description

The image editor is currently checking imagerotate() directly to decide whether it should enable the rotate buttons.

We should be checking the image editor.

The initial patch is a bit creative because we assume rotate() is a required function with the WP_Image_Editor class.

Attachments (4)

22597.diff (4.4 KB) - added by DH-Shredder 17 months ago.
22597.2.diff (2.3 KB) - added by DH-Shredder 17 months ago.
22597.3.diff (2.3 KB) - added by DH-Shredder 17 months ago.
22597.4.diff (2.3 KB) - added by DH-Shredder 17 months ago.
Also passes the mime_type for a more correct response, although this requires pulling the mime from the post.

Download all attachments as: .zip

Change History (12)

DH-Shredder17 months ago

DH-Shredder17 months ago

comment:1 DH-Shredder17 months ago

Got some extra stuff accidentally in initial patch.
22597.2.diff is the proper one.

comment:2 markoheijnen17 months ago

  • Milestone changed from Awaiting Review to 3.5

comment:3 scribu17 months ago

  • Cc scribu added

comment:4 nacin17 months ago

array( 'methods', array( 'rotate' ) ) — this should be 'methods' => array( 'rotate' ), I imagine?

DH-Shredder17 months ago

comment:5 DH-Shredder17 months ago

Yes, yes it should have been, thanks.
Now it is, and has been further/better tested.

DH-Shredder17 months ago

Also passes the mime_type for a more correct response, although this requires pulling the mime from the post.

comment:6 DH-Shredder17 months ago

As a second option, 22597.4.diff​ also passes mime_type through to check for support.

This requires pulling the mime from the post, though.

It is more accurate, however, since you could get in a situation where rotate() is supported by an editor, but the mime type is not (for instance, in the case of a GD install that is sadly lacking of imagerotate() along with a really old Imagick install lacking setIteratorIndex() when trying to rotate a GIF.

Related: #22543

comment:7 nacin17 months ago

  • Keywords commit added

I'm game for 22597.4.diff.

comment:8 ryan17 months ago

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

In 22863:

In wp_image_editor(), use wp_image_editor_supports() to check for rotation capabilities rather than directly checking the existence of the imagerotate function.

In WP_Image_Editor_GD::test(), check for existence of imagerotate if the rotate capability is required.

Props DH-Shredder
fixes #22597

Note: See TracTickets for help on using tickets.