我正在使用 App Engine 来存储和提供来自 Cloudstorage 的图像。我正在使用记录在案的 API here创建直接从 Google 提供图像的 URLS,而不通过我的应用程序。要获取 URLS,我使用 get_serving_url()
返回 ggpht.com
域上的 URL。
所有这些都运行良好,但我宁愿使用我自己的子域来提供图像。如记录here ,这对于通过 googleapis.com
访问的 CGS 存储桶是可能的,但是当从 googleapis.com 提供图像时,您无法通过向 url 添加参数来动态转换图像。
documentation for the Images API说:
If you supply the arguments, this method returns a URL encoded with the arguments specified. If you do not supply any arguments, this method returns the default URL for the image, for example:
http://your_app_id.appspot.com/randomStringImageId
这表明可以在 appspot.com
域上获取 URL 而不是 ggpht.com
这将是完美的,因为我可以设置 CNAME对于 appspot 域。遗憾的是,我无法弄清楚如何制作文档 promise 的 URLS 之一。
是否有可能两全其美?我自己的子域上的图像是通过允许通过 url 参数进行即时操作的图像 api 机制提供的吗?
最佳答案
如果您仔细阅读 document 中的行,你会发现他们已经明确提到,这个方法(get_serving_URL())返回的URL是always public,但不可猜测; 私有(private) URL 目前不是 支持。我认为您尝试使用私有(private) URL 来提供目前不可能的图像。他们将来可能会这样做。
关于google-app-engine - Google App Engine - Image API URLS 的 CNAME,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27971644/