WordPress.org

Make WordPress Core

Changeset 24727


Ignore:
Timestamp:
07/17/2013 09:16:44 PM (5 years ago)
Author:
ryan
Message:

Fix editing images with GD when using streams.

Props rmccue, markoheijnen, nacin
fixes #24459

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class-wp-image-editor-gd.php

    r24055 r24727  
    402402        }
    403403    }
     404
     405    /**
     406     * Either calls editor's save function or handles file as a stream.
     407     *
     408     * @since 3.5.0
     409     * @access protected
     410     *
     411     * @param string|stream $filename
     412     * @param callable $function
     413     * @param array $arguments
     414     * @return boolean
     415     */
     416    protected function make_image( $filename, $function, $arguments ) {
     417        if ( wp_is_stream( $filename ) )
     418            $arguments[1] = null;
     419
     420        return parent::make_image( $filename, $function, $arguments );
     421    }
    404422}
  • trunk/wp-includes/class-wp-image-editor.php

    r24055 r24727  
    328328     */
    329329    protected function make_image( $filename, $function, $arguments ) {
    330         $dst_file = $filename;
    331 
    332         // The directory containing the original file may no longer exist when using a replication plugin.
    333         wp_mkdir_p( dirname( $dst_file ) );
    334 
    335330        if ( $stream = wp_is_stream( $filename ) ) {
    336             $filename = null;
    337331            ob_start();
     332        } else {
     333            // The directory containing the original file may no longer exist when using a replication plugin.
     334            wp_mkdir_p( dirname( $filename ) );
    338335        }
    339336
     
    343340            $contents = ob_get_contents();
    344341
    345             $fp = fopen( $dst_file, 'w' );
     342            $fp = fopen( $filename, 'w' );
    346343
    347344            if ( ! $fp )
Note: See TracChangeset for help on using the changeset viewer.