|
-
Nov 11th, 2004, 04:58 AM
#1
Thread Starter
New Member
dinamicaly generated images on an asp.net page
I have generated an image (a graphic) dinamicaly with GDI+. I want to show this image on a web page.
The only way that i found to to this is to save it as a file on the server's HDD and instruct the client to use it from there.
I don't like this way.
1) i have to make a diferent file for every client that access my page.
2) i had to improvize in order to trick the browser to reload the image when it is changed. When the client ask for another graphic, i generate it and save it with the same name. But at post back the browser beliefs that the image wasn't changed and does not reread it form the server. My trick was to ask the image with a parameter that changes every time but i do not use it.
Code:
ImageBmp.ImageUrl = Me.WebImagePath & "bioritm" & Me.Id & ".bmp?j=" & Now()
ImageBmp is my image
Me.WebImagePath is the path where the page is located (and where the image is located)
"bioritm" & Me.Id & ".bmp is the name of the file
Me.Id is the unic identifier of the client generated in function of the moment of witch he accessed the page
?j=" & Now() - And now this is the parameter that is changing every time the user ask for a new graphic. The parameter is in fact the time of the reqest moment.
But i belive that there is a simple way of doing this. I intuitively belive that mast be a way to send the image directly. Without saveing it on the disk.
And i want an answer: Is anybody there who know how to do it?
.o0 Alex 0o.
-
Nov 11th, 2004, 07:53 AM
#2
I wonder how many charact
I think the common way of serving this is to develop an empty asp.net page, that simply writes out the binary bytes of the image to the response stream.
So you make a page (let's call it imgSrv.aspx) that does nothing but accept parameters and then return a stream of image bytes.
So on some other page, you can feed the parameters through the ImageUrl to your imgSrv.aspx.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|