WordPress.org

Make WordPress Core

Ticket #9245: imagejpeg_filter.9245.diff

File imagejpeg_filter.9245.diff, 1.0 KB (added by filosofo, 5 years ago)
  • wp-includes/media.php

     
    378378        else { 
    379379                // all other formats are converted to jpg 
    380380                $destfilename = "{$dir}/{$name}-{$suffix}.jpg"; 
    381                 if (!imagejpeg( $newimage, $destfilename, apply_filters( 'jpeg_quality', $jpeg_quality ) ) ) 
     381                if (!imagejpeg( $newimage, $destfilename, apply_filters( 'jpeg_quality', $jpeg_quality, 'image_resize' ) ) ) 
    382382                        return new WP_Error('resize_path_invalid', __( 'Resize path invalid' )); 
    383383        } 
    384384 
  • wp-admin/includes/image.php

     
    6868 
    6969        $dst_file = preg_replace( '/\\.[^\\.]+$/', '.jpg', $dst_file ); 
    7070 
    71         if ( imagejpeg( $dst, $dst_file ) ) 
     71        if ( imagejpeg( $dst, $dst_file, apply_filters( 'jpeg_quality', 90, 'wp_crop_image' ) ) ) 
    7272                return $dst_file; 
    7373        else 
    7474                return false;