如何在 Google App Engine 中批量上传图像 BLOB?

发布于 2024-07-17 00:59:29 字数 362 浏览 2 评论 0原文

我有一个模型,*我想*包含一个图像斑点。 我的本地文件系统上有图像,但由于应用程序的性质,我需要将它们获取到数据存储中。 这是我的模型:

class JeanImage(db.Model):
    type = db.StringProperty(required=True, choices=set(["main","front","back","detail"]))
    image = db.BlobProperty(required=True)

我还没有尝试过任何东西,因为我不擅长处理图像。

我应该如何/应该将图像转换为 blob,以便将它们放入批量上传 csv 文件中?

标记

I have a model which *I want* to contain an image blob. I have the images on my local filesystem, but due to the nature of my application, I need to get them in the datastore. Here's my model:

class JeanImage(db.Model):
    type = db.StringProperty(required=True, choices=set(["main","front","back","detail"]))
    image = db.BlobProperty(required=True)

I haven't tried anything yet because I'm not great when dealing with images.

How can/should I convert my images to blobs so that I can get them in my bulkupload csv file?

Mark

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

楠木可依 2024-07-24 00:59:29

您可以做到这一点,只是不能使用批量上传器。 您需要直接访问远程API。

该网站有一个如何使用它的基本示例:
http://www.billkatz.com/2009/2/Remote- API-Hello-World

它非常慢,并且有一个重试机制是个好主意。

更详细的描述可以在这里找到:
http://code.google.com/appengine/articles/remote_api.html

You can do it, just not with the bulk uploader. You need to access the remote api directly.

This site has a basic example of how to use it:
http://www.billkatz.com/2009/2/Remote-API-Hello-World

Its pretty slow and a good idea to have a retry mechanism.

A more detailed description can be found here:
http://code.google.com/appengine/articles/remote_api.html

明月夜 2024-07-24 00:59:29

我相信使用应用程序引擎批量加载程序无法实现您想要实现的目标。

相反,尝试自己创建某种上传器。 例如,您可以将图像作为 zip 文件上传,然后将其解压缩并将其存储在数据存储中。 如果您可以将图像映射到数据存储实体(例如通过使用命名约定),那么代码应该相当简单。

I believe that what you are trying to achieve is not possible using the app engine bulkloader.

Instead try to create some kind of uploader yourself. For example you could upload the images as a zip file and then extract it an store it in the datastore. The code for that should be fairly straightforward if you can map your images to the datastore entity (e.g. by using a naming convention).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文