473,769 Members | 5,836 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Output stream question

Hi!

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

//Move array to response stream.
Response.Conten tType = "image/jpeg";
Response.Output Stream.Write(ar rBt, 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.Conten tType = "text/html";
Response.Output Stream.Write((b yte[])ScaledImageWeb Path, 0,
(int)ScaledImag eWebPath.Length );
Response.End();

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

Nov 17 '05 #1
3 5095
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******** ********@TK2MSF TNGP09.phx.gbl. ..
Hi!

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

//Move array to response stream.
Response.Conten tType = "image/jpeg";
Response.Output Stream.Write(ar rBt, 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.Conten tType = "text/html";
Response.Output Stream.Write((b yte[])ScaledImageWeb Path, 0,
(int)ScaledImag eWebPath.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******** ******@TK2MSFTN GP10.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******** ********@TK2MSF TNGP09.phx.gbl. ..
Hi!

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

//Move array to response stream.
Response.Conten tType = "image/jpeg";
Response.Output Stream.Write(ar rBt, 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.Conten tType = "text/html";
Response.Output Stream.Write((b yte[])ScaledImageWeb Path, 0, (int)ScaledImag eWebPath.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.as px' ...>

--
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******** ********@TK2MSF TNGP09.phx.gbl. ..
Hi!

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

//Move array to response stream.
Response.Conten tType = "image/jpeg";
Response.Output Stream.Write(ar rBt, 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.Conten tType = "text/html";
Response.Output Stream.Write((b yte[])ScaledImageWeb Path, 0,
(int)ScaledImag eWebPath.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
1832
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 gives back its output in a piecemeal manner, with long delays between the outputs. In the main program I want to therefore read the output in a non-blocking manner, to read as many bytes as the child process is spitting out. The question is, how...
12
3215
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 to stdout/stderr, I'd like it to write to stdout, to a file, and/or call a logging function. So my output function might look something like this: OutputFacility& OutputFacility::put(const std::string& s) { cout << s; // print to stdout
4
3571
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 first step, I've created a variable: bool useConsole(true); then I trap all output like: if(useConsole){ cout << text; }
6
4622
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 console as well as to file, my code is as below, ======================================================================= #include <iostream.h> #include<ostream> #include<sstream>
3
10156
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 think the relevant portions of the standard are:
11
5218
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 the "problem" lies in the C library implementation of wcsftime()). I'm not sure if this is a platform-dependent feature or part of the C standard. I've compiled with GCC 3.4.3 on GNU/Linux, and run in an en_GB UTF-8
0
1064
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 when you stay in remain into DOS windows. As soon as you want to execute within the windows another program, it doesn't work. I specify that the external program I want to control is NRCMD from Network
7
3540
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 id="North"> <revenue>10</revenue> <growth>9</growth>
8
5916
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 can do it with fopen, mpz_out_str, rewind, fgets. Is there a better way such as using pipe or fdopen, dup etc? Basically, I want (headers, variable declarations, error checking excluded)
0
9416
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10199
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10032
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9979
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9849
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8861
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7393
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5433
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2810
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.