5 messages in com.googlegroups.bloggerdevRe: Uploading images to blogger posts...
FromSent OnAttachments
stanza14 Feb 2008 03:35 
Jeff Scudder15 Feb 2008 09:26 
stanza17 Feb 2008 04:26 
stanza18 Feb 2008 04:23 
Jeff Scudder21 Feb 2008 17:15 
Subject:Re: Uploading images to blogger posts via API (Zend_Gdata)
From:Jeff Scudder (j.@google.com)
Date:02/15/2008 09:26:10 AM
List:com.googlegroups.bloggerdev

On Feb 14, 3:35 am, stanza <stan@gmail.com> wrote:

Hi,

I am able to post simple posts on blogger using the Zend_Gdata. However, I have no idea how to add photos to the posts.

What I currently try is something like:

$client = Zend_Gdata_ClientLogin::getHttpClient($this->username,
$this->password, 'blogger');

$gdClient = new Zend_Gdata($client); $entry = $gdClient->newMediaEntry(); $source = new Zend_Gdata_App_MediaFileSource($file); $source->setContentType("image/jpg"); $entry->setMediaSource($source); $uri = "http://www.blogger.com/feeds/" . $this->externalID . "/posts/ default";

$createdPost = $gdClient->insertEntry($entry, $uri);

What I get in return is a message:

Expected response code 200, got 415

Can anyone help?

When you upload images through the Blogger UI, they are saved in Picasa Web Albums. It just so happens that Picasa Web Albums has a Google Data API which is very similar to the Blogger API. The Zend_Gdata library has a client for Picasa, so you may already have everything you need. The documentation and other resources for the Picasa Web Albums API can be found here:

http://code.google.com/apis/picasaweb/overview.html

Happy coding,

Jeff