1

I have to display an image,which is in base64 string format. It's working fine in ie9,chrome and mozilla.But when using ie8 image is not completly displaying.Due to security purpose i am not able save image on server and user url for displaying image.Is there any other way to display image on ie8.

1
  • Could you make a fiddle with the image? It's alot easier to help you, if we can replicate the problem. Nov 25, 2013 at 7:48

1 Answer 1

2

As per the answer from Ryan McGrath at Internet Explorer and Base64 image display: IE8 can only show Base64 images up to 32KB in size.

Most likely your image is too large to be handled by IE8.

I don't have the time to write an extensive example right now, but a possible workaround would be to serve the image through another webpage. Read the image into a stream and send it back. For example, you might do something like this:

void GetImage(int imageId) {
    byte[] imageData = GetDataFromDatabase(imageId);
    using (MemoryStream ms = new MemoryStream(imageData)) {
        Response.ContentType = "image/png";
        ms.WriteTo(Response.OutputStream);
    }
}

And then in your webpage you could do something like this:

<img src="Image.aspx?GetImage&imageId=1"/>

Note: All of the this is non-working code and possibly contains typos and non-existing methods. But it's just an idea to get you started. If you perform a Google search for "C# + asp.net output image" you get a whole bunch of results with working code samples, such as http://www.codeproject.com/Articles/33310/C-Save-and-Load-Image-from-Database.

1
  • It's true.can you suggest any alternative solution.Image strored in my database as byte format.How can i display image compactable in all browsers. Nov 25, 2013 at 8:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.