473,396 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

images using graphics class

Gav
Hi all,

I'm trying to create a bitmap and then use outputstream to display the
picture:

objBitmap.Save(Response.OutputStream, ImageFormat.Jpeg);

It doesn't give me any errors although the web page comes up with lots of
characters in the page instead of a picture... I then added:

Response.ContentType= "image/jpeg";

I put this before the outputstream but it didn't make any difference, does
anybody know what I could be doing wrong?

Regards
Gav
Nov 16 '05 #1
3 1279
base.Response.ClearContent();
base.Response.ContentType = "image/jpeg";
objBitmap.Save(Response.OutputStream, ImageFormat.Jpeg);
// Important to cancel page HTML rendering:
base.Response.End();

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Gav" <sp**@spam.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Hi all,

I'm trying to create a bitmap and then use outputstream to display the
picture:

objBitmap.Save(Response.OutputStream, ImageFormat.Jpeg);

It doesn't give me any errors although the web page comes up with lots of
characters in the page instead of a picture... I then added:

Response.ContentType= "image/jpeg";

I put this before the outputstream but it didn't make any difference, does
anybody know what I could be doing wrong?

Regards
Gav

Nov 16 '05 #2
Gav,

Is your page buffered? I seem to remember that if it is not, then the
headers would be already written, and you could not change the content type.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Gav" <sp**@spam.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Hi all,

I'm trying to create a bitmap and then use outputstream to display the
picture:

objBitmap.Save(Response.OutputStream, ImageFormat.Jpeg);

It doesn't give me any errors although the web page comes up with lots of
characters in the page instead of a picture... I then added:

Response.ContentType= "image/jpeg";

I put this before the outputstream but it didn't make any difference, does
anybody know what I could be doing wrong?

Regards
Gav

Nov 16 '05 #3
Gav
Thanks for the help but I never could get this to work. I'm not sure why. I
think it may have something to do with the fact I'm trying to do it inside a
web user control (I'm not sure). But anyway I got around it by saving it to
a file and simply displaying the file.

Thanks again
Gav

"Dennis Myrén" <de****@oslokb.no> wrote in message
news:7J****************@news4.e.nsc.no...
base.Response.ClearContent();
base.Response.ContentType = "image/jpeg";
objBitmap.Save(Response.OutputStream, ImageFormat.Jpeg);
// Important to cancel page HTML rendering:
base.Response.End();

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Gav" <sp**@spam.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Hi all,

I'm trying to create a bitmap and then use outputstream to display the
picture:

objBitmap.Save(Response.OutputStream, ImageFormat.Jpeg);

It doesn't give me any errors although the web page comes up with lots of
characters in the page instead of a picture... I then added:

Response.ContentType= "image/jpeg";

I put this before the outputstream but it didn't make any difference,
does
anybody know what I could be doing wrong?

Regards
Gav


Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Detlef Hüttenbach | last post by:
Whereas loading tiffs and pngs from file into an Image WebControl work, the images aren't shown when loaded from streams: In a WebForm, the image's property "ImageUrl" is set to a handler, and...
3
by: Hitesh | last post by:
Hi, I am getting the response from another Website by using the HttpHandler in my current site. I am getting the page but all the images on that page are not appearing only placeholder are...
0
by: Marcus Kwok | last post by:
I have written a class (Windows Form) in Managed C++ that accepts an array of image filenames and will display them sequentially. All images will be the same size. I got it to work, but I know...
0
by: Jeb Hunter | last post by:
Well, how can I describe this succinctly? I have a page with DIVs that us background images to produce a border effect. It works perfectly well, but I want to make up (for now) 3 different...
2
by: wstsoi | last post by:
hi I have to read images from spreadsheet, is it possible to do with php?
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.