WordPress.org

Make WordPress Core

Ticket #22597: 22597.3.diff

File 22597.3.diff, 2.3 KB (added by DH-Shredder, 17 months ago)
  • wp-admin/includes/image-edit.php

    diff --git wp-admin/includes/image-edit.php wp-admin/includes/image-edit.php
    index 55d5902..83b5d01 100644
    function wp_image_editor($post_id, $msg = false) { 
    4040                <div onclick="imageEdit.crop(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-crop disabled" title="<?php esc_attr_e( 'Crop' ); ?>"></div><?php 
    4141 
    4242        // On some setups GD library does not provide imagerotate() - Ticket #11536 
    43         if ( function_exists('imagerotate') ) { ?> 
     43        if ( wp_image_editor_supports( array( 'methods' => array( 'rotate' ) ) ) ) { ?> 
    4444                <div class="imgedit-rleft"  onclick="imageEdit.rotate( 90, <?php echo "$post_id, '$nonce'"; ?>, this)" title="<?php esc_attr_e( 'Rotate counter-clockwise' ); ?>"></div> 
    4545                <div class="imgedit-rright" onclick="imageEdit.rotate(-90, <?php echo "$post_id, '$nonce'"; ?>, this)" title="<?php esc_attr_e( 'Rotate clockwise' ); ?>"></div> 
    4646<?php } else { 
    47                 $note_gdlib = esc_attr__('Image rotation is not supported by your web host (function imagerotate() is missing)'); 
     47                $note_no_rotate = esc_attr__('Image rotation is not supported by your web host.'); 
    4848?> 
    49             <div class="imgedit-rleft disabled"  title="<?php echo $note_gdlib; ?>"></div> 
    50             <div class="imgedit-rright disabled" title="<?php echo $note_gdlib; ?>"></div> 
     49            <div class="imgedit-rleft disabled"  title="<?php echo $note_no_rotate; ?>"></div> 
     50            <div class="imgedit-rright disabled" title="<?php echo $note_no_rotate; ?>"></div> 
    5151<?php } ?> 
    5252 
    5353                <div onclick="imageEdit.flip(1, <?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-flipv" title="<?php esc_attr_e( 'Flip vertically' ); ?>"></div> 
  • wp-includes/class-wp-image-editor-gd.php

    diff --git wp-includes/class-wp-image-editor-gd.php wp-includes/class-wp-image-editor-gd.php
    index 8a5d846..92dd287 100644
    class WP_Image_Editor_GD extends WP_Image_Editor { 
    3737                if ( ! extension_loaded('gd') || ! function_exists('gd_info') ) 
    3838                        return false; 
    3939 
     40                // On some setups GD library does not provide imagerotate() - Ticket #11536 
     41                if ( isset( $args['methods'] ) && 
     42                         in_array( 'rotate', $args['methods'] ) && 
     43                         ! function_exists('imagerotate') ){ 
     44 
     45                                return false; 
     46                } 
     47 
    4048                return true; 
    4149        } 
    4250