Padmanaban
Padmanaban

Reputation: 119

How to display an image returning as string in classic ASP?

I have a Web Method returning the image in the form of a string.

I have to display it in the Classic ASP user interface by converting it to jpg or jpeg format.

I am able to do the same thing in ASP.NET by calling the Web Service method and converting it to formbase64 format then storing the returning string value in byte[] i.e.

byte[] byteArrayofimage = System.convert.FormBase64String(WebmethodClass.Webmethod(Parameter1,Parameter2));
Response.ContentType ="Image/Jpeg";
Response.BinaryWrite(byteArrayofimage);

but not in Classic ASP... Please help to get these lines in Classic ASP.

Upvotes: 1

Views: 2842

Answers (1)

cuixiping
cuixiping

Reputation: 25381

You can use base64 string as Data URI to display an image on web page directly, and need not a decode script. for example:

<img src="data:image/jpeg;base64,<%=base64String%>">  <!-- classic ASP -->

<img src="data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==">

Upvotes: 1

Related Questions