WordPress.org

Make WordPress Core

Ticket #2997: 2997.patch

File 2997.patch, 666 bytes (added by pishmishy, 6 years ago)

Adds filter for thumbnail jpeg quality

  • wp-admin/includes/image.php

     
    5454                default: // We'll create a Jpeg if we cant use its native file format 
    5555                        $thumb = preg_replace( '/\\.[^\\.]+$/', '.jpg', $thumb ); //Change file extension to Jpg 
    5656                case IMAGETYPE_JPEG: 
    57                         if (!imagejpeg( $thumbnail, $thumbpath ) ) 
     57                        $quality = 75; 
     58                        $quality = apply_filters('thumbnail_quality',$quality); 
     59                        if (!imagejpeg( $thumbnail, $thumbpath,$quality ) ) 
    5860                                return __( 'Thumbnail path invalid' ); 
    5961                        break; 
    6062                case IMAGETYPE_GIF: