Make WordPress Core

Ticket #29795: 29795.patch

File 29795.patch, 1.0 KB (added by Drivingralle, 8 years ago)

I have tried to write a patch to add a filter for the image quality see the patch file. In collaboration with @hinnerk and @luminuu.

  • wp-admin/includes/image-edit.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    822822                                $crop   = ( $nocrop ) ? false : get_option( "{$size}_crop" );
    823823                        }
    824824
    825                         $_sizes[ $size ] = array( 'width' => $width, 'height' => $height, 'crop' => $crop );
     825                        /**
     826                         * Filter the default image quality setting depending on the image size.
     827                         *
     828                         * @since 4.4.0
     829                         *
     830                         * @param int    $quality   Quality level between 1 (low) and 100 (high). null for applying default as specified in WP_Image_Editor
     831                         * @param string $size      Slug of image size
     832                         */
     833                        $quality = apply_filters( 'jpeg_quality', null, $size );
     834
     835                        $_sizes[ $size ] = array( 'width' => $width, 'height' => $height, 'crop' => $crop, 'quality' => $quality );
    826836                }
    827837
    828838                $meta['sizes'] = array_merge( $meta['sizes'], $img->multi_resize( $_sizes ) );