Windows Live Writer Image Upload and WordPress (WPMU)

Date July 19, 2007

My previous post http://emad.blogstogo.com/2007/07/19/window-live-writer-and-pictures/ didn’t work right away.  When I tried to post it, I received the error message
image 

Luckily, I found the fix.  The problem was in the wp-includes/class-IXR.php.  At line 138 in function parse, I replaced:

$this->message = preg_replace(’/<\?xml(.*)?\?’.'>/’, ”, $this->message);
if (trim($this->message) == ”) {
    return false;
}

with:

$rx = ‘/<?xml.*encoding=[\’”](.*?)[\’”].*?>/m’;
if (preg_match($rx, $this->message, $m)) {
       $encoding = strtoupper($m[1]);
} else {
       $encoding = “UTF-8″;
}

The first few lines of my function looked like this:

        //begin WLW fix for image upload
        //commented for WLW
        /*
        $this->message = preg_replace(’/<\?xml(.*)?\?’.'>/’, ”, $this->message);
        if (trim($this->message) == ”) {
            return false;
        }
        */
        //replaced with WLW
        $rx = ‘/<?xml.*encoding=[\’”](.*?)[\’”].*?>/m’;
        if (preg_match($rx, $this->message, $m)) {
               $encoding = strtoupper($m[1]);
        } else {
               $encoding = “UTF-8″;
        }
        //end WLW fix

kick it on DotNetKicks.com

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Close
E-mail It