473,378 Members | 1,346 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,378 software developers and data experts.

Output stream question

Hi!

I'm using output stream to output image to webpage.

//Move array to response stream.
Response.ContentType = "image/jpeg";
Response.OutputStream.Write(arrBt, 0, arrBt.Length);
Response.End();
But sometime's I want to output link to image instead of byte array.
How do I do this????

ex. //Just pass file name to response...
Response.ContentType = "text/html";
Response.OutputStream.Write((byte[])ScaledImageWebPath, 0,
(int)ScaledImageWebPath.Length);
Response.End();

(example above is not working - cannot convert string to array)

Nov 17 '05 #1
3 5077
Not sure how you can do it.
It all depends on how you are using this aspx in the HTML.
if it's <img src="my.aspx"> then you must output the binary data with the
ContentType "image/jpeg".

My guess the second will not work since browser is expecting the binary data
for image.

My guess you could save the image to the hard drive and then send an
Redirect to that image.
so browser will go and grab that image in response to <img src="my.aspx">

George.

"Ivan Demkovitch" <i@a.b> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi!

I'm using output stream to output image to webpage.

//Move array to response stream.
Response.ContentType = "image/jpeg";
Response.OutputStream.Write(arrBt, 0, arrBt.Length);
Response.End();
But sometime's I want to output link to image instead of byte array.
How do I do this????

ex. //Just pass file name to response...
Response.ContentType = "text/html";
Response.OutputStream.Write((byte[])ScaledImageWebPath, 0,
(int)ScaledImageWebPath.Length);
Response.End();

(example above is not working - cannot convert string to array)

Nov 17 '05 #2
George,

You right, I use:
<img src="my.aspx">

What do you mean by redirect? Could you give me a sample of code I use in
my.aspx to make it work?

Thanks,
Ivan

"George Ter-Saakov" <no****@hotmail.com> wrote in message
news:OR**************@TK2MSFTNGP10.phx.gbl...
Not sure how you can do it.
It all depends on how you are using this aspx in the HTML.
if it's <img src="my.aspx"> then you must output the binary data with the
ContentType "image/jpeg".

My guess the second will not work since browser is expecting the binary data for image.

My guess you could save the image to the hard drive and then send an
Redirect to that image.
so browser will go and grab that image in response to <img src="my.aspx">

George.

"Ivan Demkovitch" <i@a.b> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi!

I'm using output stream to output image to webpage.

//Move array to response stream.
Response.ContentType = "image/jpeg";
Response.OutputStream.Write(arrBt, 0, arrBt.Length);
Response.End();
But sometime's I want to output link to image instead of byte array.
How do I do this????

ex. //Just pass file name to response...
Response.ContentType = "text/html";
Response.OutputStream.Write((byte[])ScaledImageWebPath, 0, (int)ScaledImageWebPath.Length);
Response.End();

(example above is not working - cannot convert string to array)


Nov 17 '05 #3
You cannot write an image directly to an HTML page. You
can only put links to images in a page.
Normally your img tag would point to a jpg or a gif image file.
In your case you'll want it to point to a special page you've designed
specifically for outputting these images.
For example:
<img src='myimage.aspx' ...>

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com

"Ivan Demkovitch" <i@a.b> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi!

I'm using output stream to output image to webpage.

//Move array to response stream.
Response.ContentType = "image/jpeg";
Response.OutputStream.Write(arrBt, 0, arrBt.Length);
Response.End();
But sometime's I want to output link to image instead of byte array.
How do I do this????

ex. //Just pass file name to response...
Response.ContentType = "text/html";
Response.OutputStream.Write((byte[])ScaledImageWebPath, 0,
(int)ScaledImageWebPath.Length);
Response.End();

(example above is not working - cannot convert string to array)

Nov 17 '05 #4

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

Similar topics

3
by: Yuan HOng | last post by:
In my program I have to call an external program and parse its output. For that I use the os.popen2 function, and then read the output stream. But the complexity is that the external program...
12
by: Matt Garman | last post by:
I'd like to create a "custom output facility". In other words, I want an object whose use is similar to std::cout/std::cerr, but offers more flexibility. Instead of simply writing the parameter...
4
by: Joe C | last post by:
I've written a console application and would like to isolate all screen output so that it will be easier to migrate the code to a GUI-type platform without modification to the base code. As a...
6
by: radnoraj | last post by:
Hi, I am sucessfull in redirecting console output to a file. but in this case nothing is displayed on the console, cout output is written to file without display. how do write the output to...
3
by: Fernando Arbeiza | last post by:
Hi: I need some clarification about a code like this: printf("%s", "a string with NO trailing newline"); scanf("%d", &i); Regarding if a fflush() of the standard output is needed or not. I...
11
by: Roger Leigh | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The program listed below demonstrates the use of wcsftime() and std::time_put<wchar_t> which is a C++ wrapper around it. (I know this isn't C; but...
0
by: Christophe HELFER | last post by:
Hi, I've post some question last week about redirecting input and output console. Then I've received some example code from H.K. Wagner to see how redirecting works. This example works fine...
7
by: mjarends | last post by:
I'm using JAXP for XSLT - I'm using the examples from http://www.w3.org/TR/xslt#section-Examples. I'm using the following XML file: <?xml version="1.0" encoding="UTF-8"?> <sales> <division...
8
by: walter.preuninger | last post by:
I am writing a program, using the gmp library. I need to take the output (mpz_out_str) and put it back into a string. Is there an easy way to take stream output, and 'place it' into a string? I...
1
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.