WordPress.org

Make WordPress Core

Ticket #15606: post.php.patch

File post.php.patch, 1.2 KB (added by acumensystems, 9 years ago)

Post.php Logic Clarification

  • wp-includes/post.php

     
    38953895
    38963896       $ext = preg_match('/\.([^.]+)$/', $file, $matches) ? strtolower($matches[1]) : false;
    38973897
    3898        $image_exts = array('jpg', 'jpeg', 'gif', 'png');
     3898       // allow adjustments to thumbnailable extensions
     3899        $image_exts = apply_filters(
     3900               'thumbnailable_extensions',
     3901               array('jpg', 'jpeg', 'gif', 'png')
     3902       );
    38993903
    3900        if ( 'image/' == substr($post->post_mime_type, 0, 6) || $ext && 'import' == $post->post_mime_type && in_array($ext, $image_exts) )
     3904       // what do we know about the attachment?
     3905       $is_mime_image    = 'image/' == substr($post->post_mime_type, 0, 6);
     3906       $is_thumbnailable = in_array($ext, $image_exts);
     3907
     3908       // if the mime type has this as an image, then it's an image
     3909       if($is_mime_image)
    39013910               return true;
     3911
     3912       // if it's an otherwise imported image, but we accept the file extension...
     3913       if($is_thumbnailable)
     3914               return true;
     3915
    39023916       return false;
    39033917}
    39043918