I am using a plugin to forward photo posts from wordpress to a tumblr blog.
I have the following code:
//post blog to tumblr
function postBlogTumblr($postID)
{
$URLServer = "http://www.tumblr.com/api/write";
$t_post = get_post($postID);
$t_url = get_permalink($postID);
$tumblr_data = unserialize(get_option("tumblr"));
$postdata['email'] = $tumblr_data['tumblr_login_email'];
$postdata['password'] = $tumblr_data['tumblr_login_pass'];
$postdata['type'] = "photo";
$postdata['source'] = the_attachment_link($attachment_id);
$postdata['caption'] = $t_post->post_title."(via adamblanchard.co.uk)";
$postdata['state'] = "published";
$postdata = http_build_query($postdata);
$result = datapost($URLServer,$postdata);
}
I believe I am using the right method on the $postdata['source'] line, but I am unsure how to go about getting the attachment id.
Any guidance would be greatly appreciated.