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

How to display multiple images in one browser window?

Can I use WriteFile methods? It seems that it does not work.
For example, the following code only dispay one figure.
Response.WriteFile("images/image002.jpg")
Response.Write("<br><p>")
Response.WriteFile("images/image003.jpg")
Response.Write("<br><p>")

Any help?

Thanks

David
Nov 19 '05 #1
5 2924
<img> tags require an independant request tot he server for the JPG data,
so you can't interlace JPG and HTML data in the response back to the browser.
You'll have to setup a secondary page or IHttpHandler to serve those up.
Or just set the <img src="images/foo.fpg"> path and let the normal webserver
serve up those static files.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Can I use WriteFile methods? It seems that it does not work. For
example, the following code only dispay one figure.
Response.WriteFile("images/image002.jpg") Response.Write("<br><p>")
Response.WriteFile("images/image003.jpg") Response.Write("<br><p>")

Any help?

Thanks

David


Nov 19 '05 #2
Is it the static way for displaying images? Can i dynamically display .jpg
files in this way? For example, I convert images into .jpg format and display
them on the web page in runtime on request.

David

"Brock Allen" wrote:
<img> tags require an independant request tot he server for the JPG data,
so you can't interlace JPG and HTML data in the response back to the browser.
You'll have to setup a secondary page or IHttpHandler to serve those up.
Or just set the <img src="images/foo.fpg"> path and let the normal webserver
serve up those static files.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Can I use WriteFile methods? It seems that it does not work. For
example, the following code only dispay one figure.
Response.WriteFile("images/image002.jpg") Response.Write("<br><p>")
Response.WriteFile("images/image003.jpg") Response.Write("<br><p>")

Any help?

Thanks

David


Nov 19 '05 #3
On Tue, 10 May 2005 12:50:06 -0500, david
<da***@discussions.microsoft.com> wrote:
Is it the static way for displaying images? Can i dynamically display
.jpg
files in this way? For example, I convert images into .jpg format and
display
them on the web page in runtime on request.

David

"Brock Allen" wrote:
<img> tags require an independant request tot he server for the JPG
data,
so you can't interlace JPG and HTML data in the response back to the
browser.
You'll have to setup a secondary page or IHttpHandler to serve those up.
Or just set the <img src="images/foo.fpg"> path and let the normal
webserver
serve up those static files.

-Brock
DevelopMentor
http://staff.develop.com/ballen
> Can I use WriteFile methods? It seems that it does not work. For
> example, the following code only dispay one figure.
> Response.WriteFile("images/image002.jpg") Response.Write("<br><p>")
> Response.WriteFile("c") Response.Write("<br><p>")
>
> Any help?
>
> Thanks
>
> David
>



You want to create an aspx to handle displaying an image, have it do the
WriteFile() using a QueryString argument passed in.

Let's call this page foo.aspx and the querystring arg is imageUrl. Then
in my main page (where I want to show the image) I would do

<img src="foo.aspx?imageUrl=images%2Fimage002.jpg" >...
<img src="foo.aspx?imageUrl=iamges%2Fimage003.jpg" >...

note I URL encoded the / to %2F. Now in foo.aspx, you want to remove all
code, whitespace, html, everything from the .aspx file; then in the
..aspx.vb or .aspx.cs do all the work of displaying the image via
WriteFile() (write the file with url = imageUrl). You can also Google
around a little bit for a thorough example, you'll want to set the
content-type to the image type you are using in foo.aspx as well as some
miscellaneous response settings.

Why remove everything from .aspx? You can only have 1 MIME type per
response. Previously (as pointed out the other poster) you had
intermingled image and html data. Doesn't work. And if anything is in
your .aspx (other than directives), it will be compiled as a Literal
(HTML) and spit out with the response, once again mixing MIME types
inadvertently.

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Nov 19 '05 #4
Thank you, Craig.

I will try this way.

David

"Craig Deelsnyder" wrote:
On Tue, 10 May 2005 12:50:06 -0500, david
<da***@discussions.microsoft.com> wrote:
Is it the static way for displaying images? Can i dynamically display
.jpg
files in this way? For example, I convert images into .jpg format and
display
them on the web page in runtime on request.

David

"Brock Allen" wrote:
<img> tags require an independant request tot he server for the JPG
data,
so you can't interlace JPG and HTML data in the response back to the
browser.
You'll have to setup a secondary page or IHttpHandler to serve those up.
Or just set the <img src="images/foo.fpg"> path and let the normal
webserver
serve up those static files.

-Brock
DevelopMentor
http://staff.develop.com/ballen

> Can I use WriteFile methods? It seems that it does not work. For
> example, the following code only dispay one figure.
> Response.WriteFile("images/image002.jpg") Response.Write("<br><p>")
> Response.WriteFile("c") Response.Write("<br><p>")
>
> Any help?
>
> Thanks
>
> David
>


You want to create an aspx to handle displaying an image, have it do the
WriteFile() using a QueryString argument passed in.

Let's call this page foo.aspx and the querystring arg is imageUrl. Then
in my main page (where I want to show the image) I would do

<img src="foo.aspx?imageUrl=images%2Fimage002.jpg" >...
<img src="foo.aspx?imageUrl=iamges%2Fimage003.jpg" >...

note I URL encoded the / to %2F. Now in foo.aspx, you want to remove all
code, whitespace, html, everything from the .aspx file; then in the
..aspx.vb or .aspx.cs do all the work of displaying the image via
WriteFile() (write the file with url = imageUrl). You can also Google
around a little bit for a thorough example, you'll want to set the
content-type to the image type you are using in foo.aspx as well as some
miscellaneous response settings.

Why remove everything from .aspx? You can only have 1 MIME type per
response. Previously (as pointed out the other poster) you had
intermingled image and html data. Doesn't work. And if anything is in
your .aspx (other than directives), it will be compiled as a Literal
(HTML) and spit out with the response, once again mixing MIME types
inadvertently.

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET

Nov 19 '05 #5
I have an example of a dynamic thumnail generator. This might give you some
ideas:

http://staff.develop.com/ballen/blog...8-9aff48bf2481

-Brock
DevelopMentor
http://staff.develop.com/ballen
Is it the static way for displaying images? Can i dynamically display
.jpg files in this way? For example, I convert images into .jpg format
and display them on the web page in runtime on request.

David

"Brock Allen" wrote:
<img> tags require an independant request tot he server for the JPG
data, so you can't interlace JPG and HTML data in the response back
to the browser. You'll have to setup a secondary page or IHttpHandler
to serve those up. Or just set the <img src="images/foo.fpg"> path
and let the normal webserver serve up those static files.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Can I use WriteFile methods? It seems that it does not work. For
example, the following code only dispay one figure.
Response.WriteFile("images/image002.jpg") Response.Write("<br><p>")
Response.WriteFile("images/image003.jpg") Response.Write("<br><p>")

Any help?

Thanks

David


Nov 19 '05 #6

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

Similar topics

2
by: Tyrone Slothrop | last post by:
I am coding a site which involves uploading images. All of the PHP and display is OK but the client wants to be able to display the image thumbnail on the upload page and show the full image on...
3
by: RAllsopp | last post by:
I have a client who would like to have several pictures associated with one system. I have read about storing only the pathname to save OLE overhead and have set-up a form for my client to...
2
by: Adam | last post by:
I have extensively searched for a solution. Below is my code that is contained in an aspx. When my browser hits this aspx, I just get the standard broken image picture. I know the data is the...
6
by: Steve Mauldin | last post by:
I have three websites that were developed by using the same code in .net. They are all located under wwwroot on my desktop running windows 2000 pro.because Windows 2000 pro only supports a single...
4
by: drew197 | last post by:
I am a newbie. I am editing someone elses code to make it compatible with Firefox and Safari. In IE, when you click on the proper link, a block of text is shown in a nice paragraph form. But, in...
18
by: fishwick | last post by:
I haven't really done any css in quite a while, and am banging my head against the wall trying get the rudimentary layout together of a church website home page to display correctly - I don't want...
0
by: Linta | last post by:
Hi, Actually i want to display mutiple images using BinaryWrite method. I am able to store all the images in an object.My problem is that i couldnt display all that images in the browser. I am...
9
by: tshad | last post by:
This was posted before but the message got messed up (all NLs were stripped out for some reason). I have 2 labels that hold the name of different images on my .aspx page. <asp:Label ID="Logo"...
2
by: wreed06 | last post by:
Hello, I have 2 problems. In my webpage, I have a dropdown list with a button that takes the user to a popup window specific to the option. I am using Firefox 2.0.0.13. I have successfully...
0
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
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...
1
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)...
0
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
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....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.