473,473 Members | 1,936 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Images in asp...

Hi all,

Sorry if its been asked in here before but...

....how would i go about having an asp page send an image to the browser?

what i mean is instead of:
<img src="image.jpg"/>

I want:
<img src="image.asp?image=2"/>

Any idea's, pointers, url's would be appreciated, as google is firing
blanks.

Thanks in advance

--
Regards, Posting from:
Jack Turner? ¤Sunny Ol' Wolverhampton
Jul 22 '05 #1
8 1603
Something like <img src="image.asp?image=2"/> would simply be using an ASP
page as the source. Instead, write a method using Sub that will take a
parameter and write the desired image. I don't know what the names of your
image files are, but if they are image1.jpg, image2.jpg, imageX.jpg, etc.,
you could write something like:

<%
Sub ImageFile(filename_suffix)
Response.Write("<img src=" & Chr(34) & "image" & filename_suffix &
".jpg" & Chr(34) & " />")
End Sub
%>

And then use the following:

<%
ImageFile "1"
ImageFile "2"
ImageFile "X"
%>

To give the following output:

<img src="image1.jpg" />
<img src="image2.jpg" />
<img src="imageX.jpg" />

You will probably want to modify this code to your desire, and maybe put it
in a loop if you have a bunch of images like image1.jpg, image2.jpg,
image3.jpg, etc. that you would like next to each other. I hope this helps.
--
Nathan Sokalski
nj********@hotmail.com
www.nathansokalski.com

"Jack Turner" <Jack@jt3k(nospammy).co.uk> wrote in message
news:f1*****************@text.news.blueyonder.co.u k...
Hi all,

Sorry if its been asked in here before but...

...how would i go about having an asp page send an image to the browser?

what i mean is instead of:
<img src="image.jpg"/>

I want:
<img src="image.asp?image=2"/>

Any idea's, pointers, url's would be appreciated, as google is firing
blanks.

Thanks in advance

--
Regards, Posting from:
Jack Turner? ¤Sunny Ol' Wolverhampton

Jul 22 '05 #2
Just a side note, always hit www.aspfaq.com first :}
You'll find this to be an incredible resource.

--
Curt Christianson
Site & Scripts: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Jack Turner" <Jack@jt3k(nospammy).co.uk> wrote in message
news:f1*****************@text.news.blueyonder.co.u k...
Hi all,

Sorry if its been asked in here before but...

...how would i go about having an asp page send an image to the browser?

what i mean is instead of:
<img src="image.jpg"/>

I want:
<img src="image.asp?image=2"/>

Any idea's, pointers, url's would be appreciated, as google is firing
blanks.

Thanks in advance

--
Regards, Posting from:
Jack Turner? ¤Sunny Ol' Wolverhampton

Jul 22 '05 #3
In a weird place they call a newsgroup, Nathan Sokalski woke up and
posted news:%2****************@TK2MSFTNGP11.phx.gbl using
nj********@hotmail.com as their email address:
|| Something like <img src="image.asp?image=2"/> would simply be using
|| an ASP page as the source.

Thats what i want, i want it so i can prevent hotlinking asp-side.

IE on the asp source it has to have a valid refering address, else it
redirects the user to an error image.
--
Regards, Posting from:
Jack Turner? ¤Sunny Ol' Wolverhampton
Jul 22 '05 #4
Jack Turner wrote on 03 feb 2005 in
microsoft.public.inetserver.asp.general:
In a weird place they call a newsgroup, Nathan Sokalski woke up and
posted news:%2****************@TK2MSFTNGP11.phx.gbl using
nj********@hotmail.com as their email address:
|| Something like <img src="image.asp?image=2"/> would simply be using
|| an ASP page as the source.

Thats what i want, i want it so i can prevent hotlinking asp-side.

IE on the asp source it has to have a valid refering address, else it
redirects the user to an error image.


Stream your image:

<http://aspfaq.com/show.asp?id=2276>

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 22 '05 #5
Gazing into my crystal ball I observed "Jack Turner" <Jack@jt3k
(nospammy).co.uk> writing in news:dtfMd.5950$8B3.1077
@text.news.blueyonder.co.uk:
In a weird place they call a newsgroup, Nathan Sokalski woke up and
posted news:%2****************@TK2MSFTNGP11.phx.gbl using
nj********@hotmail.com as their email address:
|| Something like <img src="image.asp?image=2"/> would simply be using
|| an ASP page as the source.

Thats what i want, i want it so i can prevent hotlinking asp-side.

IE on the asp source it has to have a valid refering address, else it
redirects the user to an error image.


<% if request.servervariables("HTTP_HOST") = "www.example.com" then %>
<img src="yourimage.png" alt="Your image description" />
<% else %>
<img src="badimage.png" alt="Stop Thief!" />
<% end if %>

--
Adrienne Boswell
http://www.cavalcade-of-coding.info
Please respond to the group so others can share
Jul 22 '05 #6
Adrienne wrote on 04 feb 2005 in microsoft.public.inetserver.asp.general:
Gazing into my crystal ball I observed "Jack Turner" <Jack@jt3k
(nospammy).co.uk> writing in news:dtfMd.5950$8B3.1077
@text.news.blueyonder.co.uk:
In a weird place they call a newsgroup, Nathan Sokalski woke up and
posted news:%2****************@TK2MSFTNGP11.phx.gbl using
nj********@hotmail.com as their email address:
|| Something like <img src="image.asp?image=2"/> would simply be using
|| an ASP page as the source.

Thats what i want, i want it so i can prevent hotlinking asp-side.

IE on the asp source it has to have a valid refering address, else it
redirects the user to an error image.


<% if request.servervariables("HTTP_HOST") = "www.example.com" then %>
<img src="yourimage.png" alt="Your image description" />
<% else %>
<img src="badimage.png" alt="Stop Thief!" />
<% end if %>


This will not help you, as the path to the img is available clientside.

The only solution is to stream the img as an asp page testing for
referrer first.

<http://aspfaq.com/show.asp?id=2276>

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 22 '05 #7
Gazing into my crystal ball I observed "Evertjan."
<ex**************@interxnl.net> writing in news:Xns95F38FF45B686eejj99@
194.109.133.29:
Adrienne wrote on 04 feb 2005 in microsoft.public.inetserver.asp.general:
Gazing into my crystal ball I observed "Jack Turner" <Jack@jt3k
(nospammy).co.uk> writing in news:dtfMd.5950$8B3.1077
@text.news.blueyonder.co.uk:
In a weird place they call a newsgroup, Nathan Sokalski woke up and
posted news:%2****************@TK2MSFTNGP11.phx.gbl using
nj********@hotmail.com as their email address:
|| Something like <img src="image.asp?image=2"/> would simply be using
|| an ASP page as the source.

Thats what i want, i want it so i can prevent hotlinking asp-side.

IE on the asp source it has to have a valid refering address, else it
redirects the user to an error image.


<% if request.servervariables("HTTP_HOST") = "www.example.com" then %>
<img src="yourimage.png" alt="Your image description" />
<% else %>
<img src="badimage.png" alt="Stop Thief!" />
<% end if %>


This will not help you, as the path to the img is available clientside.

The only solution is to stream the img as an asp page testing for
referrer first.

<http://aspfaq.com/show.asp?id=2276>


You're right. I have the flu... wasn't thinking

--
Adrienne Boswell
http://www.cavalcade-of-coding.info
Please respond to the group so others can share
Jul 22 '05 #8
Adrienne wrote on 04 feb 2005 in microsoft.public.inetserver.asp.general:
<http://aspfaq.com/show.asp?id=2276>


You're right. I have the flu... wasn't thinking


Be well soon.

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 22 '05 #9

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

Similar topics

7
by: Wayne | last post by:
I have a script that uses filesystemobject that reads files from a given path, in my case images. It is running on a server that is 2000 adv svr w/ all current patches. The script prior to some...
3
by: Dave | last post by:
Hi, I have an app that uses rollover images, but the images are still pulled from the web server during a mouseover instead of being pulled from memory. The code is as follows: the...
3
by: Simon | last post by:
This problem has been driving me mad for months.... Seen a few posts on forums about it but no answers... No mention on MSDN etc. XP Pro SP1, VS.NET (c#) .Net framework 1.1, IIS 5.1. In a...
4
toxicpaint
by: toxicpaint | last post by:
Hi, can anyone give me a hand. I'm currently displaying 4 random images at the top of a page. I did this using an array of 35 pictures and then writing them to page. The problem I have is that in...
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
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...
1
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
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,...
1
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
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...

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.