“数据:图像/ JPG; BASE64”以及Internet Explorer的jQuery图像preVIEW [英] 'data:image/jpg;base64' and jQuery image preview in Internet Explorer

查看:167
本文介绍了“数据:图像/ JPG; BASE64”以及Internet Explorer的jQuery图像preVIEW的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到一个的Base64 EN codeD从方法的照片。我以编程方式添加为图像的SRC。然后,我用了灯箱的jQuery插件来显示图像的preVIEW。在Firefox和Chrome一切工作正常,但在Internet &浏览器NBSP; 9为图像preVIEW只显示我的形象几行

I get a Base64 encoded photo from a method. And I add it programmatically as a src of an image. Then I use a the jQuery lightBox plugin to show a preview of a image. In Firefox and Chrome everything works fine, but in Internet Explorer 9 as an image preview shows only a few lines of my image.

因此​​图像不显示作为一个整体;它仅示出它的一个小百分比。其余的消失,它看起来像是停在某个时刻加载它。该Base64是罚款,在其他Web浏览器显示的整体形象,而且只有在Internet&NBSP问题。资源管理器

So the image is not displayed as a whole; it's showing only a small percentage of it. The rest disappeared, and it looks like something stopped loading it at some moment. The Base64 is fine, in other web browsers the whole image appears, and there are only problems with Internet Explorer.

在我的aspx:

<script type="text/javascript">
    $(function () {
        $('#gallery a').lightBox({ fixedNavigation: true });
    });
</script>

<div id="gallery">
    <a id="aPhoto" runat="server">
        <img alt="photo" id="imgPhoto" runat="server" /></a>
</div>

在我的aspx.cs文件:

In my aspx.cs file:

imgPhoto.Attributes.Add("src", "data:image/jpg;base64," + base64Image);

所以我插入这样的事情到aspx文件:

So I insert something like this into the aspx file:

imgPhoto.Attributes.Add("src", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==");

如何修改它与Internet&NBSP工作;浏览器

How do I modify it to work with Internet Explorer?

推荐答案

我已经有这样的问题。这种不兼容的原因主要是 =服务器中的图像标签,也许在锚标记属性。试试这个,也许你的问题就会得到解决:

I already have a problem like this. The main reason for this incompatibility is the runat="server" attribute in the image tag and maybe in the anchor tag. Try this, maybe your problem will be solved:

<script type="text/javascript">
    $(function () {
        $('#gallery a').lightBox({ fixedNavigation: true });
    });
</script>

<div id="mainDiv" runat="server">
</div>

而在 code背后

...
string innerHtml = "<div id='gallery'><a id='aPhoto'><img alt='photo' id='imgPhoto' /></a></div>";
mainDiv.innerHtml = innerHtml;
...

这篇关于“数据:图像/ JPG; BASE64”以及Internet Explorer的jQuery图像preVIEW的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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