WordPress.org

Make WordPress Core

Ticket #30154: image-edit-30154-1.diff

File image-edit-30154-1.diff, 7.5 KB (added by HristoK, 5 years ago)

Diff for wp-admin/includes/image-edit.php

  • wp-admin/includes/image-edit.php

     
    4242        ?>
    4343        <div class="imgedit-wrap">
    4444        <div id="imgedit-panel-<?php echo $post_id; ?>">
     45        <div class="imgedit-panel-content">
     46                <?php echo $note; ?>
     47                <div class="imgedit-menu">
     48                        <div onclick="imageEdit.crop(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-crop disabled" title="<?php esc_attr_e( 'Crop' ); ?>"></div><?php
    4549
     50                // On some setups GD library does not provide imagerotate() - Ticket #11536
     51                if ( wp_image_editor_supports( array( 'mime_type' => get_post_mime_type( $post_id ), 'methods' => array( 'rotate' ) ) ) ) { ?>
     52                        <div class="imgedit-rleft"  onclick="imageEdit.rotate( 90, <?php echo "$post_id, '$nonce'"; ?>, this)" title="<?php esc_attr_e( 'Rotate counter-clockwise' ); ?>"></div>
     53                        <div class="imgedit-rright" onclick="imageEdit.rotate(-90, <?php echo "$post_id, '$nonce'"; ?>, this)" title="<?php esc_attr_e( 'Rotate clockwise' ); ?>"></div>
     54        <?php } else {
     55                        $note_no_rotate = esc_attr__('Image rotation is not supported by your web host.');
     56        ?>
     57                    <div class="imgedit-rleft disabled"  title="<?php echo $note_no_rotate; ?>"></div>
     58                    <div class="imgedit-rright disabled" title="<?php echo $note_no_rotate; ?>"></div>
     59        <?php } ?>
     60
     61                        <div onclick="imageEdit.flip(1, <?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-flipv" title="<?php esc_attr_e( 'Flip vertically' ); ?>"></div>
     62                        <div onclick="imageEdit.flip(2, <?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-fliph" title="<?php esc_attr_e( 'Flip horizontally' ); ?>"></div>
     63
     64                        <div id="image-undo-<?php echo $post_id; ?>" onclick="imageEdit.undo(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-undo disabled" title="<?php esc_attr_e( 'Undo' ); ?>"></div>
     65                        <div id="image-redo-<?php echo $post_id; ?>" onclick="imageEdit.redo(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-redo disabled" title="<?php esc_attr_e( 'Redo' ); ?>"></div>
     66                        <br class="clear" />
     67                </div>
     68
     69                <input type="hidden" id="imgedit-sizer-<?php echo $post_id; ?>" value="<?php echo $sizer; ?>" />
     70                <input type="hidden" id="imgedit-history-<?php echo $post_id; ?>" value="" />
     71                <input type="hidden" id="imgedit-undone-<?php echo $post_id; ?>" value="0" />
     72                <input type="hidden" id="imgedit-selection-<?php echo $post_id; ?>" value="" />
     73                <input type="hidden" id="imgedit-x-<?php echo $post_id; ?>" value="<?php echo isset( $meta['width'] ) ? $meta['width'] : 0; ?>" />
     74                <input type="hidden" id="imgedit-y-<?php echo $post_id; ?>" value="<?php echo isset( $meta['height'] ) ? $meta['height'] : 0; ?>" />
     75
     76                <div id="imgedit-crop-<?php echo $post_id; ?>" class="imgedit-crop-wrap">
     77                <img id="image-preview-<?php echo $post_id; ?>" onload="imageEdit.imgLoaded('<?php echo $post_id; ?>')" src="<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>?action=imgedit-preview&amp;_ajax_nonce=<?php echo $nonce; ?>&amp;postid=<?php echo $post_id; ?>&amp;rand=<?php echo rand(1, 99999); ?>" />
     78                </div>
     79
     80                <div class="imgedit-submit">
     81                        <input type="button" onclick="imageEdit.close(<?php echo $post_id; ?>, 1)" class="button" value="<?php esc_attr_e( 'Cancel' ); ?>" />
     82                        <input type="button" onclick="imageEdit.save(<?php echo "$post_id, '$nonce'"; ?>)" disabled="disabled" class="button button-primary imgedit-submit-btn" value="<?php esc_attr_e( 'Save' ); ?>" />
     83                </div>
     84        </div>
    4685        <div class="imgedit-settings">
    4786        <div class="imgedit-group">
    4887        <div class="imgedit-group-top">
     
    82121
    83122<?php } ?>
    84123
    85         <div class="imgedit-group">
     124        <div class="imgedit-group imgedit-crop">
    86125        <div class="imgedit-group-top">
    87126                <h3><?php _e('Image Crop'); ?> <a href="#" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);return false;"></a></h3>
    88127
     
    151190        <?php } ?>
    152191
    153192        </div>
    154 
    155         <div class="imgedit-panel-content">
    156                 <?php echo $note; ?>
    157                 <div class="imgedit-menu">
    158                         <div onclick="imageEdit.crop(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-crop disabled" title="<?php esc_attr_e( 'Crop' ); ?>"></div><?php
    159 
    160                 // On some setups GD library does not provide imagerotate() - Ticket #11536
    161                 if ( wp_image_editor_supports( array( 'mime_type' => get_post_mime_type( $post_id ), 'methods' => array( 'rotate' ) ) ) ) { ?>
    162                         <div class="imgedit-rleft"  onclick="imageEdit.rotate( 90, <?php echo "$post_id, '$nonce'"; ?>, this)" title="<?php esc_attr_e( 'Rotate counter-clockwise' ); ?>"></div>
    163                         <div class="imgedit-rright" onclick="imageEdit.rotate(-90, <?php echo "$post_id, '$nonce'"; ?>, this)" title="<?php esc_attr_e( 'Rotate clockwise' ); ?>"></div>
    164         <?php } else {
    165                         $note_no_rotate = esc_attr__('Image rotation is not supported by your web host.');
    166         ?>
    167                     <div class="imgedit-rleft disabled"  title="<?php echo $note_no_rotate; ?>"></div>
    168                     <div class="imgedit-rright disabled" title="<?php echo $note_no_rotate; ?>"></div>
    169         <?php } ?>
    170 
    171                         <div onclick="imageEdit.flip(1, <?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-flipv" title="<?php esc_attr_e( 'Flip vertically' ); ?>"></div>
    172                         <div onclick="imageEdit.flip(2, <?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-fliph" title="<?php esc_attr_e( 'Flip horizontally' ); ?>"></div>
    173 
    174                         <div id="image-undo-<?php echo $post_id; ?>" onclick="imageEdit.undo(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-undo disabled" title="<?php esc_attr_e( 'Undo' ); ?>"></div>
    175                         <div id="image-redo-<?php echo $post_id; ?>" onclick="imageEdit.redo(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-redo disabled" title="<?php esc_attr_e( 'Redo' ); ?>"></div>
    176                         <br class="clear" />
    177                 </div>
    178 
    179                 <input type="hidden" id="imgedit-sizer-<?php echo $post_id; ?>" value="<?php echo $sizer; ?>" />
    180                 <input type="hidden" id="imgedit-history-<?php echo $post_id; ?>" value="" />
    181                 <input type="hidden" id="imgedit-undone-<?php echo $post_id; ?>" value="0" />
    182                 <input type="hidden" id="imgedit-selection-<?php echo $post_id; ?>" value="" />
    183                 <input type="hidden" id="imgedit-x-<?php echo $post_id; ?>" value="<?php echo isset( $meta['width'] ) ? $meta['width'] : 0; ?>" />
    184                 <input type="hidden" id="imgedit-y-<?php echo $post_id; ?>" value="<?php echo isset( $meta['height'] ) ? $meta['height'] : 0; ?>" />
    185 
    186                 <div id="imgedit-crop-<?php echo $post_id; ?>" class="imgedit-crop-wrap">
    187                 <img id="image-preview-<?php echo $post_id; ?>" onload="imageEdit.imgLoaded('<?php echo $post_id; ?>')" src="<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>?action=imgedit-preview&amp;_ajax_nonce=<?php echo $nonce; ?>&amp;postid=<?php echo $post_id; ?>&amp;rand=<?php echo rand(1, 99999); ?>" />
    188                 </div>
    189 
    190                 <div class="imgedit-submit">
    191                         <input type="button" onclick="imageEdit.close(<?php echo $post_id; ?>, 1)" class="button" value="<?php esc_attr_e( 'Cancel' ); ?>" />
    192                         <input type="button" onclick="imageEdit.save(<?php echo "$post_id, '$nonce'"; ?>)" disabled="disabled" class="button button-primary imgedit-submit-btn" value="<?php esc_attr_e( 'Save' ); ?>" />
    193                 </div>
    194193        </div>
    195 
    196         </div>
    197194        <div class="imgedit-wait" id="imgedit-wait-<?php echo $post_id; ?>"></div>
    198195        <script type="text/javascript">jQuery( function() { imageEdit.init(<?php echo $post_id; ?>); });</script>
    199196        <div class="hidden" id="imgedit-leaving-<?php echo $post_id; ?>"><?php _e("There are unsaved changes that will be lost. 'OK' to continue, 'Cancel' to return to the Image Editor."); ?></div>