Make WordPress Core

Ticket #24459: 24459.4.diff

File 24459.4.diff, 1.8 KB (added by markoheijnen, 12 years ago)
  • wp-includes/class-wp-image-editor-gd.php

     
    401401                                return imagejpeg( $this->image, null, $this->quality );
    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}
  • wp-includes/class-wp-image-editor.php

     
    327327         * @return boolean
    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
    340337                $result = call_user_func_array( $function, $arguments );
     
    342339                if ( $result && $stream ) {
    343340                        $contents = ob_get_contents();
    344341
    345                         $fp = fopen( $dst_file, 'w' );
     342                        $fp = fopen( $filename, 'w' );
    346343
    347344                        if ( ! $fp )
    348345                                return false;