Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#22597 closed defect (bug) (fixed)

Image Editor checking GD directly for rotate support

Reported by: kirasong's profile kirasong Owned by: ryan's profile 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 kirasong 12 years ago.
22597.2.diff (2.3 KB) - added by kirasong 12 years ago.
22597.3.diff (2.3 KB) - added by kirasong 12 years ago.
22597.4.diff (2.3 KB) - added by kirasong 12 years 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)

@kirasong
12 years ago

@kirasong
12 years ago

#1 @kirasong
12 years ago

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

#2 @markoheijnen
12 years ago

  • Milestone changed from Awaiting Review to 3.5

#3 @scribu
12 years ago

  • Cc scribu added

#4 @nacin
12 years ago

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

@kirasong
12 years ago

#5 @kirasong
12 years ago

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

@kirasong
12 years ago

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

#6 @kirasong
12 years 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

#7 @nacin
12 years ago

  • Keywords commit added

I'm game for 22597.4.diff.

#8 @ryan
12 years 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.