How to dynamically stream images through Browser?

  • Thread starter Sherif ElMetainy
  • Start date
S

Sherif ElMetainy

Hello

if you already have an image file somewhere

string filaname = "C:\myimage.png");
Response.ContentType = "image/png";
Response.WriteFile(filaname);
Response.End();

Or if you want to generate the image dynamically

int width = 400, height = 300; // 400 * 300 image
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(width, height);
// Do some drawing with the bmp object ...
Response.ContentType = "image/png";
bmp.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Png);
Response.End();


Best regards,
Sherif
 
R

Raed Sawalha

I have seen on some websites, image references that instead of image, are
other ASP, ASP.NET or CGI pages. The link would be like <img
src="imagegenerator.asp?imageid=1235">. I would like to use this technique
to dynamically deliver images to the user. How do i create the "back-end"
page to read an image file and then "stream" that raw image data to the
user?

Regards
 
S

Shiva

Here is a sample:
http://www.aspfree.com/c/a/ASP.NET/Retrieving-Images-from-a-Database--C---Part-II/

I have seen on some websites, image references that instead of image, are
other ASP, ASP.NET or CGI pages. The link would be like <img
src="imagegenerator.asp?imageid=1235">. I would like to use this technique
to dynamically deliver images to the user. How do i create the "back-end"
page to read an image file and then "stream" that raw image data to the
user?

Regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top