Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: image_editor_output_format

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
2676                }
2677           }
2678
2679           /*
2680            * Check if an image will be converted after uploading or some existing image sub-size file names may conflict
2681            * when regenerated. If yes, ensure the new file name will be unique and will produce unique sub-sizes.
2682            */
2683           if ( $is_image ) {
2684                /** This filter is documented in wp-includes/class-wp-image-editor.php */
2685                $output_formats = apply_filters( 'image_editor_output_format', array(), $_dir . $filename, $mime_type );
2686                $alt_types      = array();
2687
2688                if ( ! empty( $output_formats[ $mime_type ] ) ) {
2689                     // The image will be converted to this format/mime type.
2690                     $alt_mime_type = $output_formats[ $mime_type ];
2691
2692                     // Other types of images whose names may conflict if their sub-sizes are regenerated.
2693                     $alt_types   = array_keys( array_intersect( $output_formats, array( $mime_type, $alt_mime_type ) ) );
2694                     $alt_types[] = $alt_mime_type;