Make WordPress Core

Changeset 22863


Ignore:
Timestamp:
11/27/2012 02:36:55 PM (12 years ago)
Author:
ryan
Message:

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

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/image-edit.php

    r22817 r22863  
    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( 'mime_type' => get_post_mime_type( $post_id ), '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
  • trunk/wp-includes/class-wp-image-editor-gd.php

    r22817 r22863  
    3737        if ( ! extension_loaded('gd') || ! function_exists('gd_info') )
    3838            return false;
     39
     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        }
    3947
    4048        return true;
Note: See TracChangeset for help on using the changeset viewer.