是否可以仅通过查看 URL 来确定资源是否托管在 BlobStore 上?
假设我有一个应用程序,其图像托管在不同的地方......其中一些是 BlobStore。我想编写一个 showThumbnail() 帮助程序,它将获取 URL 并生成具有高度/宽度的标签。其中一些图像托管在可以进行动态调整大小的服务器上...就像在 BlobStore 中一样,我可以指定 s=xxx 来调整其大小...而其他服务使用不同的参数。
我是否可以查看 URL 并确定图像由 BlobStore 托管,以便我知道要附加哪些查询参数以进行动态调整大小?我看到的 URL 看起来像 *.ggpht.com ...这种情况会一直如此吗?
Lets say I have an app that has images hosted in various places... some of them being BlobStore. I want to write a showThumbnail() helper that will take a URL and generate an tag with height/width. Some of these images are hosted on servers that can do dynmic resizing... like in BlobStore I can specify s=xxx to resize it... where other services use different parameters.
is it possible for me to look at the URL and determine that the image is being hosted by BlobStore, so that I know which query params to append for dynamic resizing? the URLs I see look like *.ggpht.com ... will this always be the case?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一般来说,对于 blobstore,@waffle paradox 是正确的 - blob 可以由任何处理程序透明地提供服务。我想您不仅询问 Blobstore,还特别询问快速图像服务支持。在这种情况下,是的,它们都将由 ggpht.com 域提供服务 - 但这是一个实现细节,理论上将来可能会发生变化,因此您最好嵌入一些元数据在您的页面中,表明它是 blobstore 图像。
For blobstore in general, @waffle paradox is correct - a blob can be served by any handler, transparently. I presume you're asking not just about Blobstore though, but specifically about the fast image serving support. In that case, yes, they'll all be served off the
ggpht.com
domain - but that's an implementation detail, and could theoretically change in future, so you'd be far better off embedding some metadata in your page that indicates that it's a blobstore image.我不确定您所说的
*.ggpht.com
是什么意思以及您在哪里看到它,但简短的回答是:不。 blobstore 文档指出,要提供 blob,您必须定义您自己的服务/下载处理程序,因此无法仅通过 URL 判断某些内容是否托管在 blobstore 上。对于您的问题,我建议如果可以的话跟踪哪些图像来自 blobstore,或者重新组织托管的完成方式(如果可以的话)。
I'm not sure what you mean by
*.ggpht.com
and where you saw it, but the short answer is: no. The blobstore documentation states that to serve blobs, you have to define your own serving/downloading handler, so there's no way to tell if something is hosted on the blobstore simply by the URL.For your problem, I would suggest tracking which images come from the blobstore if you can, or re-organizing the way the hosting is done (if you can).