【问题标题】:How to retrieve image into the jsp from the google app engine(java)如何从谷歌应用引擎(java)检索图像到jsp
【发布时间】:2012-12-15 09:29:24
【问题描述】:

我正在寻找将图像检索到 jsp 中。

我找到了this link

但是在这里我无法将图像检索到我想要的 jsp 中,它只是显示图像

【问题讨论】:

  • 您能否说明您需要下载它还是需要在您的 JSP 上显示它。
  • 不,我不想下载它。只是我想在我的jsp中使用图像
  • 表示你想在 UI 上显示它。如果是这样,我在下面为您提供了解决方案。

标签: java google-app-engine image-uploading blobstore


【解决方案1】:

我建议您将来自 Blobstore 的图像作为图像服务提供,它会为您的图像提供更好的性能、尺寸等。

请参阅下面的代码。

ImagesService services = ImagesServiceFactory.getImagesService();
ServingUrlOptions serve = ServingUrlOptions.Builder.withBlobKey(blobKey);    // Blobkey of the image uploaded to BlobStore.
String url = services.getServingUrl(serve);

您将获得图片的 URL,您可以轻松地将其放入 HTML 的 Image 标签中。

<img src="url" />

您可以从这里了解更多关于 AppEngine 的图像服务的信息。 GAE Image Services

【讨论】:

  • OP 已经在这样做了——他显然设法显示了图像。
猜你喜欢
  • 1970-01-01
  • 2017-05-03
  • 2013-05-03
  • 2011-01-26
  • 1970-01-01
  • 2017-01-07
  • 1970-01-01
  • 2011-11-21
  • 2012-06-11
相关资源
最近更新 更多