If I would like to place in a page both text and image,
is it possible? And, in case, how would I correct the following
code ?
'tetx
Response.ContentType = "text.html"
Response.Write("Hello hello")
'image
Response.ContentType = "image/jpeg"
Dim b As New Bitmap(200, 200)
Dim g As Graphics = Graphics.FromImage(b)
g.FillRectangle(New SolidBrush(Color.Red), 0, 0, 200, 200)
b.Save(Response.OutputStream, ImageFormat.Jpeg)
g.Dispose()
b.Dispose()
Steve C. Orr [MVP, MCSD] - 22 Sep 2006 16:01 GMT
The text needs to be output into a regular HTML page.
That HTML page needs to have a regular image tag, such as <img
src="MyImage.aspx">
Then in MyImage.aspx you need to output the image with content type
image/jpeg as you noted.
This can only be done with two pages as I've described. One page will not
work. IE6 does not support doing two content types in a single page.
Here's more info:
http://SteveOrr.net/articles/ImproveYourImages.aspx

Signature
I hope this helps,
Steve C. Orr
MCSD, MVP, CSM
http://SteveOrr.net
> If I would like to place in a page both text and image,
> is it possible? And, in case, how would I correct the following
[quoted text clipped - 12 lines]
> g.Dispose()
> b.Dispose()
Hans Kesting - 22 Sep 2006 16:42 GMT
> The text needs to be output into a regular HTML page.
> That HTML page needs to have a regular image tag, such as <img
[quoted text clipped - 5 lines]
> This can only be done with two pages as I've described. One page will not
> work. IE6 does not support doing two content types in a single page.
If I understand it correctly, it's not an error (or shortcoming) on the
part of IE, but a limitation of the HTTP protocol. This means that NO
browser can handle "double content".
Hans Kesting
Steve C. Orr [MVP, MCSD] - 24 Sep 2006 06:26 GMT
> If I understand it correctly, it's not an error (or shortcoming) on the
> part of IE, but a limitation of the HTTP protocol. This means that NO
> browser can handle "double content".
Actually most other browsers do support embedded images, just not IE6...

Signature
I hope this helps,
Steve C. Orr
MCSD, MVP, CSM
http://SteveOrr.net
Hans Kesting - 25 Sep 2006 09:01 GMT
>> If I understand it correctly, it's not an error (or shortcoming) on the
>> part of IE, but a limitation of the HTTP protocol. This means that NO
>> browser can handle "double content".
>
> Actually most other browsers do support embedded images, just not IE6...
You learn something new every day ...
Hans Kesting
pamelafluente@libero.it - 22 Sep 2006 16:51 GMT
Thanks Steve.
I downloaded your code. Beautiful !
Ciao,
-P
Steve C. Orr [MVP, MCSD] ha scritto:
> The text needs to be output into a regular HTML page.
> That HTML page needs to have a regular image tag, such as <img
[quoted text clipped - 31 lines]
> > g.Dispose()
> > b.Dispose()
bruce barker (sqlwork.com) - 22 Sep 2006 16:46 GMT
this can be done with most modern browsers, but not ie (until version 7).
<img src="data:image/gif;base64,thisIsbase64ImageContent">
-- bruce (sqlwork.com)
> If I would like to place in a page both text and image,
> is it possible? And, in case, how would I correct the following
[quoted text clipped - 12 lines]
> g.Dispose()
> b.Dispose()
Baski - 22 Sep 2006 19:06 GMT
1. You can create a sample aspx page like below
<html>
<body>
<table>
<tr>
<td>
<asp:Label id=lblHelloWorld runat=server>Hello
World<asp:label>
</td>
</tr>
<tr>
<td>
<img src=GetImage.aspx?ImagID="imageName">
</td>
</tr>
</table>
</body>
</html>
2. write a new page called GetImage.aspx on page load of this page
if(Request["ImageID"] != null)
Response.WriteFile("..images/Request["ImageID"] ); //I assume you
stored all your image in image folder under the root.
> If I would like to place in a page both text and image,
> is it possible? And, in case, how would I correct the following
[quoted text clipped - 12 lines]
> g.Dispose()
> b.Dispose()
pamelafluente@libero.it - 23 Sep 2006 00:46 GMT
Thank you Baski for the nice and clear example,
it is very useful to have it.
-P
Baski ha scritto:
> 1. You can create a sample aspx page like below
>
[quoted text clipped - 37 lines]
> > g.Dispose()
> > b.Dispose()