hi
i want to put the name of my site in corner of my images
i've used from graphics and bitmap class and i have no problem with
putting the text
but it make problem with other works in my page
for example :
//-------------------------- begin
Bitmap bitMapImage = new
System.Drawing.Bitmap(Server.MapPath("image/" + 2 + ".jpg"));
Graphics graphicImage = Graphics.FromImage(bitMapImage);
graphicImage.SmoothingMode = SmoothingMode.AntiAlias;
Rectangle rect = new Rectangle(1,1,50,50);
graphicImage.DrawString("irankohan.com", new Font("Arial", 12,
FontStyle.Bold), SystemBrushes.WindowText, new Point(13, 27));
graphicImage.DrawArc(new Pen(Color.White, 3), 90, 235, 150, 50, 0,
360);
Response.ContentType = "image/jpeg";
bitMapImage.Save(Response.OutputStream, ImageFormat.Jpeg);
//--------------------------- end
Label lb = new Label();
lb.Text = "milad";
Controls.Add(lb);
i wanna show information about the picture dynamically but it can't
be shown
why ? 5 1286
<mi********@gmail.comwrote in message
news:05**********************************@d45g2000 hsc.googlegroups.com...
hi
i want to put the name of my site in corner of my images
i've used from graphics and bitmap class and i have no problem with
putting the text
but it make problem with other works in my page
for example :
//-------------------------- begin
Bitmap bitMapImage = new
System.Drawing.Bitmap(Server.MapPath("image/" + 2 + ".jpg"));
Graphics graphicImage = Graphics.FromImage(bitMapImage);
graphicImage.SmoothingMode = SmoothingMode.AntiAlias;
Rectangle rect = new Rectangle(1,1,50,50);
graphicImage.DrawString("irankohan.com", new Font("Arial", 12,
FontStyle.Bold), SystemBrushes.WindowText, new Point(13, 27));
graphicImage.DrawArc(new Pen(Color.White, 3), 90, 235, 150, 50, 0,
360);
Response.ContentType = "image/jpeg";
bitMapImage.Save(Response.OutputStream, ImageFormat.Jpeg);
//--------------------------- end
Label lb = new Label();
lb.Text = "milad";
Controls.Add(lb);
i wanna show information about the picture dynamically but it can't
be shown
why ?
Its not clear but my guess is that you believe that you can simply stream
out the image content as part of the rest of the HTML content of a page. Or
am I way off? If I am whats the Label code above doing?
You need to place this code in a .ashx file and have all your img srcs point
to it with the name of the image as a querystring parameter.
Make sure you configure the response cache headers correctly so that the
generated img can be cached clientside and hopeful by ASP.NET response
caching as well.
--
Anthony Jones - MVP ASP/ASP.NET
On Sep 11, 3:23*pm, "miladha...@gmail.com" <miladha...@gmail.com>
wrote:
hi
i want to put the name of my site in corner of my images
i've used from graphics and bitmap class and i have no problem with
putting the text
but it make problem with other works in my page
for example :
//-------------------------- *begin
*Bitmap bitMapImage = new
* * *System.Drawing.Bitmap(Server.MapPath("image/" + 2 + ".jpg"));
* Graphics graphicImage = Graphics.FromImage(bitMapImage);
* graphicImage.SmoothingMode = SmoothingMode.AntiAlias;
* * * * Rectangle rect = new Rectangle(1,1,50,50);
* graphicImage.DrawString("irankohan.com", new Font("Arial", 12,
FontStyle.Bold), SystemBrushes.WindowText, new Point(13, 27));
* graphicImage.DrawArc(new Pen(Color.White, 3), 90, 235, 150, 50, 0,
360);
* Response.ContentType = "image/jpeg";
* bitMapImage.Save(Response.OutputStream, ImageFormat.Jpeg);
//--------------------------- end
*Label lb = new Label();
*lb.Text = "milad";
*Controls.Add(lb);
*i wanna show information about the picture dynamically but it can't
be shown
why ?
Because here you said that response is an image
Response.ContentType = "image/jpeg";
As Anthony already mentioned you should separate the code for images
from the code for html layout.
hi to both of you
thanks for your answers
but i change the Response.ContentType to text/html but no change was
happend
do you have sample about it ?
i wanna get my images url and information about it from Db
thanks for your helps
On Sep 11, 7:50*pm, "miladha...@gmail.com" <miladha...@gmail.com>
wrote:
hi to both of you
thanks for your answers
but i change the Response.ContentType to text/html but no change was
happend
do you have sample about it ?
i wanna get my images url and information about it from Db
thanks for your helps
You have to move the code for images into ASPX, or ASHX "file".
I mean the code between
//-------------------------- begin
....
//--------------------------- end
Next, refer to that file as
<img src="MyImageFile.aspx">
and do the rest.
Regarding Response.ContentType. Sure, it's not only because of its
value. It does specify content type for the response for the browser
and browser will render the content on its own logic. In your example,
ContentType will not help because at the beginning you sent already
some piece of binary information and it cannot be rendered properly
together with HTML markup. This is the reason why you need to create a
separate web page that would serve for the binary output (your image)
and a regular ASP.NET webform to render the HTML markup.
"Alexey Smirnov" <al************@gmail.comwrote in message
news:36**********************************@b1g2000h sg.googlegroups.com...
On Sep 11, 7:50 pm, "miladha...@gmail.com" <miladha...@gmail.com>
wrote:
hi to both of you
thanks for your answers
but i change the Response.ContentType to text/html but no change was
happend
do you have sample about it ?
i wanna get my images url and information about it from Db
thanks for your helps
>>>>>>>>
You have to move the code for images into ASPX, or ASHX "file".
I mean the code between
//-------------------------- begin
....
//--------------------------- end
Next, refer to that file as
<img src="MyImageFile.aspx">
and do the rest.
Regarding Response.ContentType. Sure, it's not only because of its
value. It does specify content type for the response for the browser
and browser will render the content on its own logic. In your example,
ContentType will not help because at the beginning you sent already
some piece of binary information and it cannot be rendered properly
together with HTML markup. This is the reason why you need to create a
separate web page that would serve for the binary output (your image)
and a regular ASP.NET webform to render the HTML markup.
>>>>>>>>>>
Use an .ashx, an aspx has way too much overhead that you're not going to
need.
--
Anthony Jones - MVP ASP/ASP.NET This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: curwen |
last post by:
Hi,
I have problem to create a well formed xsl-fo document using images
dynamically generated from an http request
using this tag:
<fo:external-graphic content-type="content-type:image/gif"...
|
by: jty202 |
last post by:
I know alot of people have the problem with indexed pixel format. I hope
someone can show me the solution to this.I am have problem with graphics
with the following code giving the error:
"A...
|
by: James A Taber |
last post by:
Problem resizing image.(JPG)
If i try to resize an img with horisontal=150 and vertical resolution=150
The quality of the target image is dramatically reduced. Source code is
provided below.
...
|
by: Michael Stock |
last post by:
Hi all,
hopefully someone can tell me how to do this for a web
server in C#:
We have images in a folder you can't access over the net.
So everytime we need to display an image from this folder,...
|
by: Richard |
last post by:
I each time get errors when I use an .bmp or ,.gif file as source but
whenever I use a .jpg file it works perfect.
Why is that? and how to fix it?
I almost have no knowledge about the...
|
by: Nathan Sokalski |
last post by:
I am having a problem saving an image with the same name it originally had. I have two similar versions of my code, one in which I close the FileStream used to open the original image before saving,...
|
by: Peter |
last post by:
I have a problem with a page show_image.asp that returns a jpg image under
Windows XP Pro SP2. The page sets content type as:
Response.ContentType = "image/jpg"
While this works perfectly fine...
|
by: Jean-François Michaud |
last post by:
Hello,
I've been looking at this for a bit now and I don't see what's wrong
with the code. Can anybody see a problem with this?
Here is an XSLT snippet I use.
<xsl:template match="graphic">...
|
by: André |
last post by:
Hi,
I want to include a graphic made in file2 into file. File must first send a
value to file2 (with Response.Redirect) which will be used for the graphic.
My problem is that only the graphic is...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |