wordpressの画像編集

wordpressのメディア挿入で、ライブラリーの画像がプレビューできず編集できなくなっていました。

対応は、
http://www.dream-seed.com/weblog/note/wordpress-image-edit を参考に、ob_end_clean()は出力バッファをクリアの一文挿入。

—–

wp-includes/class-wp-image-editor-gd.phpに 一文挿入

public function stream( $mime_type = null ) {
        list( $filename, $extension, $mime_type ) = $this->get_output_format( null, $mime_type );

        while (@ob_end_clean());  /* この行を追加 */

        switch ( $mime_type ) {
            case 'image/png':
                header( 'Content-Type: image/png' );
                return imagepng( $this->image );
            case 'image/gif':
                header( 'Content-Type: image/gif' );
                return imagegif( $this->image );
            default:
                header( 'Content-Type: image/jpeg' );
                return imagejpeg( $this->image, null, $this->get_quality() );
        }
    }

 

———————

を実行。

もう一つ、 themeの functions.php の空白行をなくす、という指摘もありましたが、そちらは実行せずにも、問題は解決しました。

ただ、コア部分の手直しなので、バージョンアップがあった時には、また修正が必要です。

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です