WordPress.org

Make WordPress Core

Ticket #16458: 16458.2.diff

File 16458.2.diff, 706 bytes (added by SergeyBiryukov, 6 years ago)
  • wp-includes/media.php

     
    455455                        return new WP_Error('resize_path_invalid', __( 'Resize path invalid' ));
    456456        } else {
    457457                // all other formats are converted to jpg
    458                 $destfilename = "{$dir}/{$name}-{$suffix}.jpg";
     458                if ( !in_array( $ext, array( 'jpg', 'jpeg' ) ) )
     459                        $ext = 'jpg';
     460                $destfilename = "{$dir}/{$name}-{$suffix}.$ext";
    459461                if ( !imagejpeg( $newimage, $destfilename, apply_filters( 'jpeg_quality', $jpeg_quality, 'image_resize' ) ) )
    460462                        return new WP_Error('resize_path_invalid', __( 'Resize path invalid' ));
    461463        }