WordPress.org

Make WordPress Core

Ticket #22538: 22538.2.diff

File 22538.2.diff, 1.0 KB (added by scribu, 2 years ago)

'image_editors' and 'image_editor_instance'

  • wp-includes/media.php

    diff --git wp-includes/media.php wp-includes/media.php
    index 131873a..06bb9a8 100644
    function wp_get_image_editor( $path, $args = array() ) { 
    11611161                        $args['mime_type'] = $file_info['type']; 
    11621162        } 
    11631163 
    1164         $implementation = apply_filters( 'wp_image_editor_class', _wp_image_editor_choose( $args ) ); 
     1164        $implementation = _wp_image_editor_choose( $args ); 
    11651165 
    11661166        if ( $implementation ) { 
    11671167                $editor = new $implementation( $path ); 
     1168 
     1169                $editor = apply_filters( 'image_editor_instance', $editor, $args ); 
     1170 
    11681171                $loaded = $editor->load(); 
    11691172 
    11701173                if ( is_wp_error( $loaded ) ) 
    function _wp_image_editor_choose( $args = array() ) { 
    12031206        require_once ABSPATH . WPINC . '/class-wp-image-editor-gd.php'; 
    12041207        require_once ABSPATH . WPINC . '/class-wp-image-editor-imagick.php'; 
    12051208 
    1206         $implementations = apply_filters( 'wp_image_editors', 
     1209        $implementations = apply_filters( 'image_editors', 
    12071210                array( 'WP_Image_Editor_Imagick', 'WP_Image_Editor_GD' ) ); 
    12081211 
    12091212        foreach ( $implementations as $implementation ) {