Making WordPress.org


Ignore:
Timestamp:
08/19/2022 03:31:47 AM (2 years ago)
Author:
dd32
Message:

Photo Directory: Disable jpeg -> webp conversions, due to significant increased memory usage causing uploads to fail.

See #6142.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/inc/uploads.php

    r11702 r12023  
    102102
    103103        /* After upload, after photo validates. */
     104
     105        // Disable jpeg to webp converstion.
     106        add_filter( 'wp_upload_image_mime_transforms',  [ __CLASS__, 'disable_jpeg_to_wepb' ] );
    104107
    105108        // Set post fields for photo.
     
    791794        }
    792795    }
     796
     797    /**
     798     * Disable conversion of uploaded jpegs to webp.
     799     *
     800     * This is required as webp appears to use a lot of memory for conversion, often running out
     801     * of memory during upload on WordPress.org. Additionally, we don't use/expose webp at present.
     802     * This may be only required temporarily, see the below Core Trac ticket for confirmation.
     803     *
     804     * @see https://meta.trac.wordpress.org/ticket/6142
     805     * @see https://core.trac.wordpress.org/ticket/55443
     806     *
     807     * @param array $transforms The mime type transforms for uploads.
     808     * @return array The modified $transforms.
     809     */
     810    public static function disable_jpeg_to_wepb( $transforms ) {
     811        if ( isset( $transforms['image/jpeg'] ) ) {
     812            $transforms['image/jpeg'] = [ 'image/jpeg' ];
     813        }
     814
     815        return $transforms;
     816    }
    793817}
    794818
Note: See TracChangeset for help on using the changeset viewer.