Re: Draw Images on fly



I'm sure your english is better than my Chinese! :)

I am not sure what all of the problems are with your solution, but I do know
of at least one, and if we eliminate them one by one we can straighten
everything out. The biggest problem is that you are attempting to insert an
image directly into a page.

An HTML document is pure text. There is no binary content in it, no images,
no Flash, no sound. These are referenced in the HTML document with tags that
contain the URL of the resource to be displayed in the browser. If you look
at the source code of any HTML page in your browser you will see this.
ASP.Net is simply a technology that, for the most part, creates HTML pages
from server-side programming. It has some other related capabilities as
well, such as the ability to send binary data from the server in an HTTP
stream.

Now, my original message said to use an ASPX page, *not* an ASCX UserControl
in a page. The reason is that there has to be a resource that can be
referenced in the HTML of another page which will send the image to the
client browser when requested. When you set the Response.ContentType to
"image/jpg" you are setting the ContentType header for the *entire*
response, which tells the browser that "xyz.aspx" is not an ASPX page, but
an image. This is *all* that the "image" ASPX page should do. Set the
Response.ContentType to "image/jpg" and write the binary image to the
Response.OutputStream. In *another* ASPX page, or even an HTML page, an HTML
image tag can be used to reference the "image" ASPX page as an image, such
as:

<img src="imageMaker.aspx" />

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

I recycle.
I send everything back to the planet it came from.

"Yankee.zhang" <yanmaha@xxxxxxx> wrote in message
news:uYEYadclGHA.2128@xxxxxxxxxxxxxxxxxxxxxxx
HI kevin£º
I'm Chinese people,
yes, i have meet the extend problem

when i using Resoponse.OutStream to display a image in an ascx , and
the ascx be using in the man page.

but there a problem, when i click the button in the main page to
drawing the image in the ascx controls,
and display it,the image is shown but the main page's contenttype turn to
"image/jepg" and the button is can not find in the man page.
can you tell me ,what can let the ascx content-type not to changed the
main page contenttype.
my english is pool thanks.

if you need the source code i can pulish to you .


"Kevin Spencer" <uce@xxxxxxx>
дÈëÏûÏ¢ÐÂÎÅ:uQ2TnvZlGHA.4512@xxxxxxxxxxxxxxxxxxxxxxx
You can use the System.Drawing namespace and draw an image in memory in
an ASPX page, and then write it to the Response.OutputStream. You have to
use the URL of the ASPX page as an image URL, and set the
Response.ContentType to "image/jpg" (or "image.gif", depending), and it
will display in another page as if it were an image.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

I recycle.
I send everything back to the planet it came from.

<mrajanikrishna@xxxxxxxxx> wrote in message
news:1150937884.743009.182260@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello friends,

I have developed an application using ASP.NET and SQL Server.
Ours is a garment factory. I need to design another module in my
application.

I want to generate images on fly based on users selection(body, sleeve
etc).
Until here no problem. Coz we have only 2 types of bodies and 3 types
of sleeves and 3 types of necks. I can design static images and save in
the system and call.

But I need to give selection of color to the user. Which color user has
selected, the image should display in that color.

Here I am strucked. So the solution is to generate images on fly as we
cant edit static images. Is there any other solution or any software
can edit the images at run time(especially color)?

Or can anyone suggest an idea?

Not ony in ASP.NET, any other also appreciated.

thanks in advance







.


Quantcast