ImageResource in ClientBundle as real <img> element

蓝咒 提交于 2020-01-16 04:50:13

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/10913588/imageresource-in-clientbundle-as-real-img-element

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!