Make WordPress Core

Ticket #45363: 45363_1.diff

File 45363_1.diff, 1.1 KB (added by benjaminpick, 6 years ago)

tentative patch

  • wp-admin/includes/image.php

    diff --git a/wp-admin/includes/image.php b/wp-admin/includes/image.php
    index 254ba7d90f..0e081266bc 100644
    a b function wp_generate_attachment_metadata( $attachment_id, $file ) { 
    160160                $metadata = wp_read_audio_metadata( $file );
    161161                $support  = current_theme_supports( 'post-thumbnails', 'attachment:audio' ) || post_type_supports( 'attachment:audio', 'thumbnail' );
    162162        }
     163       
     164        /**
     165         * Filters the mime types that have support for thumbnail generation
     166         *
     167         * @param array $other_supported_mime_types  An array of supported MIME types
     168         */
     169        $other_supported_mime_types = apply_filters( 'mime_types_thumbnail_generation', array( 'application/pdf' ) );
    163170
    164171        if ( $support && ! empty( $metadata['image']['data'] ) ) {
    165172                // Check for existing cover.
    function wp_generate_attachment_metadata( $attachment_id, $file ) { 
    216223                        }
    217224                }
    218225        } // Try to create image thumbnails for PDFs
    219         elseif ( 'application/pdf' === $mime_type ) {
     226        elseif ( in_array( $mime_type, $other_supported_mime_types, true ) ) {
    220227                $fallback_sizes = array(
    221228                        'thumbnail',
    222229                        'medium',