[wp-trac] [WordPress Trac] #23775: WP_Image_Editor Flip Method $horz and $vert arguments are backwards

WordPress Trac noreply at wordpress.org
Thu Mar 14 20:47:13 UTC 2013


#23775: WP_Image_Editor Flip Method $horz and $vert arguments are backwards
-----------------------------+--------------------------
 Reporter:  alconebay        |       Type:  defect (bug)
   Status:  new              |   Priority:  normal
Milestone:  Awaiting Review  |  Component:  General
  Version:  3.5.1            |   Severity:  minor
 Keywords:  needs-patch      |
-----------------------------+--------------------------
 The WP_Image_Editor class shows:

 {{{
 /**
  * @param boolean $horz Horizontal Flip
  * @param boolean $vert Vertical Flip
  */
 abstract public function flip( $horz, $vert );
 }}}

 But changing the first argument to true flips the image vertically and the
 second argument, when true, flips the image horizontally.
 Both imagemagick and GD are affected.

 A fix for class-wp-image-editor-imagick.php would be reversing lines 366
 and 369 (flopImage for $horz and flipImage for $vert)

 A fix for class-wp-image-editor-gd.php would be reversing $horz and $vert
 on lines 292-295 like this (fixed):

 {{{
 $sx = $horz ? ($w - 1) : 0;
 $sy = $vert ? ($h - 1) : 0;
 $sw = $horz ? -$w : $w;
 $sh = $vert ? -$h : $h;
 }}}

 I've verified these fixes.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/23775>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list