仅图像的顶部 1/3(大约)显示在面板 (SimplePanel) 中,

发布于 2024-11-08 06:29:23 字数 1254 浏览 0 评论 0原文

我正在尝试在 GWT 面板中显示 ~80K jpeg 图像。 (fwiw - 图像是从数据库表中检索的)

出于某种原因,当我尝试显示时,面板 (SimplePanel) 中仅显示顶部 1/3(大约)。分辨率较低的图像会完整显示。 --此问题似乎不是面板高度/宽度设置的函数。

这是否是由于我听说过的关于 IE 浏览器的32k 限制造成的?

如果是这样,是否有我可以用来显示图像(在 SimplePanel 中)的替代技术的完整示例 - 即,以便整个图像将显示在 IE 中?

  1. Java 1.6
  2. GWT 2.2
  3. IE 8

(涉及的代码片段)

-
-
-
//prepare image url on server (for use by client)
String base64Url = "data:image/jpeg;base64," + base64.encodeToString(imageByteArray);
-
-
-
//client retrieving image url (from server)...
AsyncCallback<String> asyncCallback = new AsyncCallback<String>()
{
    @Override
    public void onFailure(Throwable caught)
    {
        Window.alert("DetailView/setRowData/asyncCallBack/onFailure - " + caught.getMessage());
    }

    @Override
    public void onSuccess(String base64Url)
    {
        Window.alert("DetailView/setRowData/asyncCallBack/onSuccess - base64Url:" + String.valueOf(base64Url));
        imagePanel.clear();
        imagePanel.add(new Image(base64Url));
    }
};
searchValueMap.put("doc_id",doc_id.trim().toUpperCase());
service.getBase64ImageUrl(base64Url, asyncCallback);
-
-
-

I'm attempting to display a ~80K jpeg image in a GWT panel. (fwiw - the image is retrieved from a database table)

For some reason, only the top 1/3 (approximately) shows in the panel (SimplePanel), when I attempt the display. Lesser resolution images show in their entirety. --This issue does not appear to be a function of panel height/width settings.

Would this due to the 32k limit I've heard about regarding the IE brower?

If so, is there a full example of an alternate technique that I could use to display the image (in the SimplePanel) -- i.e., so that the entire image will display in IE?

  1. Java 1.6
  2. GWT 2.2
  3. IE 8

(snippet of code involved)

-
-
-
//prepare image url on server (for use by client)
String base64Url = "data:image/jpeg;base64," + base64.encodeToString(imageByteArray);
-
-
-
//client retrieving image url (from server)...
AsyncCallback<String> asyncCallback = new AsyncCallback<String>()
{
    @Override
    public void onFailure(Throwable caught)
    {
        Window.alert("DetailView/setRowData/asyncCallBack/onFailure - " + caught.getMessage());
    }

    @Override
    public void onSuccess(String base64Url)
    {
        Window.alert("DetailView/setRowData/asyncCallBack/onSuccess - base64Url:" + String.valueOf(base64Url));
        imagePanel.clear();
        imagePanel.add(new Image(base64Url));
    }
};
searchValueMap.put("doc_id",doc_id.trim().toUpperCase());
service.getBase64ImageUrl(base64Url, asyncCallback);
-
-
-

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

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

发布评论

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

评论(1

南汐寒笙箫 2024-11-15 06:29:23

RFC 2397 暗示 URL 长度是限制因素,但未指定任何特定长度:

http:// www.ietf.org/rfc/rfc2397.txt

我的经验仅是通过 GWT ResourceBundle 代码获得的。在那里,数据网址仅限于少数浏览器类型,并且任何大于 32K 的图像都无法通过数据网址发送:

http://code.google.com/p/google-web -toolkit/source/browse/trunk/user/src/com/google/gwt/resources/rebind/context/InlineResourceContext.java

RFC 2397 hints that its the URL length that is the limiting factor without specifying any particular length:

http://www.ietf.org/rfc/rfc2397.txt

My experience with this is only through the GWT ResourceBundle code. There, data urls are restricted to only a few browser types, and any image larger than 32K is not eligible to be sent through a data url:

http://code.google.com/p/google-web-toolkit/source/browse/trunk/user/src/com/google/gwt/resources/rebind/context/InlineResourceContext.java?

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