本文介绍了使用Blobstore API和Images API直接从GAE中的GCS提供图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于Blobstore和Google云存储(GCS)的许多问题和答案已有两三年历史,而这些年来事情发生了翻天覆地的变化。 GCS不再是独立的服务。现在将。



我发现这个:


说:

我知道如何。在使用Blobstore API和Images API处理图像时如何绕过GAE有任何例子吗? 解决方案

说明如下: a href =https://developers.google.com/appengine/docs/python/images/functions#Image_get_serving_url =nofollow> https://developers.google.com/appengine/docs/python/images/功能#Image_get_serving_url



从Google云端存储托管的图片开始。 首先,使用Blobstore API的create_gs_key()函数为您的GCS图像对象生成一个blob密钥。然后,将该blob键传递给Image API的get_serving_url()函数。



Image API会为您提供一个特殊的URL,以跳过您的应用引擎应用并提供图像直接。


Many questions and answers on Blobstore and Google Cloud Storage(GCS) are two or three years old, while things change dramatically these years. GCS is no longer a standalone service. It is integrated into Google App Engine (GAE) now.

Google seems to push GCS so hard that Blobstore is deprecated, for example,

I believe it is high time to switch to GCS.

For example, www.example.com is a site built on GAE, while example.jpg is an image stored on GCS, I want to serve the image using the url http://www.example.com/images/example.jpg

This used to be impossible, but now it is possible thanks to the integration.

I found this:

https://developers.google.com/appengine/docs/python/googlecloudstorageclient/says:

I do know how to 'bypassing the App Engine app'. Is there any example on how to bypass GAE while serving the images using Blobstore API and Images API?

解决方案

Instructions are here: https://developers.google.com/appengine/docs/python/images/functions#Image_get_serving_url

Start with an image hosted in Google Cloud Storage.

First, use the Blobstore API's create_gs_key() function to generate a blob key for your GCS image object. Then, pass that blob key into the Image API's get_serving_url() function.

The Image API will give you a special URL that skips over your app engine app and serves the image directly.

这篇关于使用Blobstore API和Images API直接从GAE中的GCS提供图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-10 22:32