如何在博客文章中附加图像-Google Blogger API-C#-VB.Net [英] How To Attach an Image with Blog post - Google Blogger API - C# - VB.Net

查看:32
本文介绍了如何在博客文章中附加图像-Google Blogger API-C#-VB.Net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用此代码在Blogger上创建新帖子,但我正在搜索如何在我们的帖子中附加和上传图片.

I am using this code to create new post on blogger but I was searching that how to attach and upload an image with our post.

Imports Google.GData.Blogger
Imports Google.GData.Client        

    Dim service As New BloggerService("<my apps name>")
    service.Credentials = New GDataCredentials("<email>", "<apps password>")
    Dim newPost As AtomEntry = New AtomEntry()
    newPost.Title.Text = "Test Title"
    newPost.Content = New AtomContent()
    newPost.Content.Content = "<h2>Test HTML Content</h2>"
    newPost.Content.Type = "html"
    Dim response As AtomEntry = Nothing

    Dim blogFeedUri As Uri = New Uri("http://www.blogger.com/feeds/" + "<blog ID here>" + "/posts/default")
    response = service.Insert(blogFeedUri, newPost)

推荐答案

更新

已停用PicasaWeb API,并已将其替换为Google相册库.在此处开始使用.如果您要从PicasaWeb API进行迁移,请查看以下迁移指南.

The PicasaWeb API has been discontinued and replaced with Google Photos library. Get started here. If you are migrating from PicasaWeb API, checkout the following Migration guide.

原始答案

没有直接的方法.首先将在Blogger上上传的图像上传到Picasaweb.因此,您需要同时使用picasa和Blogger API.

There is no straightforward way. The images uploaded on Blogger are first uploaded to Picasaweb. So you need to work on picasa as well as Blogger API.

您可以尝试执行以下步骤:

You can try following steps:

  1. 创建用户界面以从系统中选择图像.
  2. 使用Google Picasa API上传图像
  3. 获取上传的图片的链接,并将其添加到Blogger的HTML代码中.

这篇关于如何在博客文章中附加图像-Google Blogger API-C#-VB.Net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆