ClientBundle中的ImageResource为真正的< img>元件 [英] ImageResource in ClientBundle as real <img> element

查看:136
本文介绍了ClientBundle中的ImageResource为真正的< img>元件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

IE9不会默认打印背景图片。有没有一个选项告诉ClientBundle,所有的图像应该是真正的元素,而不是伪造的CSS背景图像? 解决方案

生成 ClientBundle ,以及如何从 ImageResource 构造图像。



默认情况下为 ClientBundle s' ImageResource s被生成为 data:所有浏览器的URL,但IE6和IE7将使用 sprited images ,就像 ImageBundle 。不过,在IE8和IE9中,您必须确保获取适当的排列,因为它们具有兼容模式,可能会使它们看起来像IE6或IE7。检查IE Developer Tools中使用的模式(点击 F12 打开它们)。

em> inline 或 external ImageResource (使用 data: http:// URL,但不是绑定,AKA sprited 图片),则可以使用 ImageResource getSafeUri()作为 src < img> 元素的属性。

不幸的是,GWT将无条件地使用所谓的裁剪图像当将 ImageResource 传递给 Image 时,基于CSS背景图像用于捆绑 $ c>或 AbstractImagePrototype 。我们称之为bug。


The IE9 does not print background images per default. Is there an option to tell ClientBundle, that all images should be real elements not fake css-background images?

解决方案

It depends how the ClientBundle is generated, and how the image is constructed from the ImageResource.

By default, ClientBundles' ImageResources are generated as data: URLs for all browsers but IE6 and IE7, which will use sprited images just like an ImageBundle. In IE8 and IE9 though, you have to make sure the appropriate permutation is picked up, because they have compatibility modes that could make them appear like IE6 or IE7. Check the mode that's being used in the IE Developer Tools (hit F12 to open them).

Given an inlined or external ImageResource (one that uses a data: or http:// URL, but not a bundled, AKA sprited image), you can then use the ImageResource's getSafeUri() as the value for the src attribute of an <img> element.
Unfortunately, GWT will unconditionally use a so-called clipped image (the technique used for bundled images, based on a CSS background image) when you pass an ImageResource to Image or AbstractImagePrototype. Let's call that a bug.

这篇关于ClientBundle中的ImageResource为真正的&lt; img&gt;元件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆