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

Home Posts Topics Members FAQ

How can I pass an image parameter in HTML? Is it possible???

Last year, I remember finding a web page describing how to pass the
name of a file to another web page, and have that web page load that
image file.

Now, I can't find my record of that (it was saved on another computer
that I can't get to right now), and I can't remember what search
parameters I used to find it when I googled the topic.

Can anyone point me the right direction? I'd like to use a method that
would be accessible to the most people, and a barrier to as few as
possible.

What I want to do, if possible, is pass the image URL to the web page
as part of the link, and have that page automatically use that image
URL in place of the default image. If you want to see a sample page,
look at http://www.godloveseveryone.org/sample/Personlz.htm ... where
you see the "GOD LOVES JOHN" maze, I'd like to have the link to that
page specify a specific image URL, and have that image show up both
places that the JOHN maze is displayed.

I hope it's possible, otherwise, I'm going to have to have 39,000
different html pages to do the same thing.

And yes, eventually, i need to learn JAVA so that I can write a program
to create those mazes on the fly. Or is there something else that this
old BASIC programmer should learn in order to do it?

John

Jul 23 '05
23 12289
In article <11************ **********@l41g 2000cwc.googleg roups.com>,
Go************* *****@gmail.com enlightened us with...
I'm going to call my support person to ask if they support PHP (I'm
guessing it was one of the acronyms he told me about six months ago
when I moved my pages to his server).
You can usually tell on the page that gives you stats and such, or right on
the signup page where they tote all the neat things they offer.
Who is your host?
<a href="someUrl.h tml?imageSrc=so meImage.gif">li nk</a>


I'm assuming this can be in any subdirectory on the page, not just in
the root directory.


Sure.

Does PHP remember the values from one PHP string to the next? Can I do
this in the heading?
Yes.
And if you put the variable into the session, it will be remembered in all
pages for that visitor for the duration of their visit.

then have these snippets of code in different places in the body:

Yup, no problem.
If you wanted to get really fancy, you could check that
the file existed before writing it. :)
How would I do that?


In php, a simple file_exists($pa th) returns boolean.

Thanks for all the help, and now that I've done the research, I'll have
to contact Brent and hope I haven't wasted your time.


Nah, never a waste to inform someone of options.
And if server-side scripting isn't supported, you can always change hosts.
My host server costs me $10 a month and supports PHP, cgi-bin, etc and has a
crapload of space and bandwidth. It also comes with a database.
It's not that expensive. Don't let them charge you too much.
If you actually know the person hosting your stuff and it's their server, PHP
can be downloaded and installed for free, so don't let them put one over on
ya. ;)

--
--
~kaeli~
Those who get too big for their britches will be exposed in
the end.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #11
In article <11************ *********@g14g2 000cwa.googlegr oups.com>,
Go************* *****@gmail.com enlightened us with...
People can even enter their own name and it will generate a
page just for them.


Hi, Kaeli,

I'd love to know how to do that also.


That's easy.
Once you have the setup for it to generate based on the passed param, test
for a lack of a passed param and prompt the user for their name.
I can show you how to do that.
--
--
~kaeli~
User: The word computer professionals use when they mean
'idiot'.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #12
Another question I thought of:

1. I just realized that I forgot to take into account the separate
directories, so the filename needs to include the initial, as in
j/john.gif
k/kaeli.gif (sorry, not there, guess I'll have to add it)
l/larry.gif
etc.

I assume this will be the PHP equivalent of
$file = left$($name,1)+ "\"+name$+".gif "

2. For some strange reason, probably related to the fact that "CON:" is
the DOS abbreviation for CONsole, I had to add a dash to "c/con.gif" to
make it "c/con-.gif". So I'll use the method you identify for #1 to
take care of #2.

3. Are comparisons case specific? When I check for "$name == 'con'"
does that also check for CON and Con?

I'll call Brent later today to ask a bout PHP. The free calls to
Gravette (the 60 minutes I spoke of) are on the same line I'm connected
on right now, doing uploads that this discussion may make redundant.

John

P.S. I do appreciate all the help.

Jul 23 '05 #13
In article <11************ *********@z14g2 000cwz.googlegr oups.com>,
Go************* *****@gmail.com enlightened us with...
Another question I thought of:

1. I just realized that I forgot to take into account the separate
directories, so the filename needs to include the initial, as in
j/john.gif
k/kaeli.gif (sorry, not there, guess I'll have to add it)
l/larry.gif
etc.

I assume this will be the PHP equivalent of
$file = left$($name,1)+ "\"+name$+".gif "

PHP:
$file = substr($name,0, 1) . "/" . $name . ".gif";
(note: slash is forward for web stuff, not backward windows-style)
The dot is the string concat operator in PHP and Perl.
A plus is only for numerics.
Unlike BASIC, PHP and Perl (they are closely related) are not strongly typed
languages (and you don't have to declare variables at all unless you want to
and specify it). This can actually lead to some really stupid problems when
you have typos. *heh*
If you give it a plus sign, it will try to convert the argument to a numeric
data type. If it can't (PHP), you'll get an error (unexpected T_PLUS or some
such, I believe) or get really odd results (perl).
Also note that VB uses the ampersand as string concat.
i.e.
myString = someString & someotherstring
2. For some strange reason, probably related to the fact that "CON:" is
the DOS abbreviation for CONsole, I had to add a dash to "c/con.gif" to
make it "c/con-.gif". So I'll use the method you identify for #1 to
take care of #2.
Well, if you're doing this locally, it will be different. PHP is run from a
web server. You can't test locally without installing Apache / PHP.
IMNSHO, best results achieved on a unix / linux box.
I upload my stuff and test it from there.
File->open just doesn't work for testing dynamically generated pages. They
have to be served from a web server.

Best to give relative references, not absolute. Absolute can give you
problems, especially once you upload. You'd have to change everything.
Use relative paths and a good directory structure.
For example, all my stuff is stored in C:\My Documents\websi tes\$websitenam e,
i.e. C:\My Documents\websi tes\WildAtHeart . So, my stuff in Wild At Heart is
all relatively referenced. There is an images folder. My pages can then do
<img src="images/imageName.jpg"> and the like.
If I move the files to another server, as long as I keep the directory names
the same, no links have to change.

3. Are comparisons case specific? When I check for "$name == 'con'"
does that also check for CON and Con?
You don't want '=='.
You want
if (strnatcasecmp( $name,"con"))
That one is case-insensitive.

Full list of PHP string functions:
http://us4.php.net/strings

P.S. I do appreciate all the help.


No problem.
--
--
~kaeli~
Any sufficiently advanced technology is indistinguishab le
from magic.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #14
You asked who my host is:

I'm using GravetteOnline. net

One of the advantages is that if I want to, I can put all my changes on
a flash drive and drive it to his office, about six miles from here.

I've left a message for him to call back. Meanwhile, I've put a test
page at www.GodLovesEveryone.org/godloves.php

When I try it in Mozilla Thunderbird, I'm getting asked if I want to
save the file to disk.

When I try it in Internet Explorer, I'm getting strange stuff on my
page, so I'm guessing he doesn't have it activated yet, or perhaps just
not activated specifically for me. I'll have to wait until he calls me
back.

(That's the problem of a small server in a small town, he and his wife
are the main contact people, and when he has to do work for the company
that he telecommutes to, he occasionally has to duck out.)

To give you an idea of how rural we are, I'm in a town of less than a
thousand people. he's in a town of closer to three thousand.

Meanwhile, if you want to glance at it, you can see if I've put
together what you said along with what I found in other places into a
logical whole. For example, at the beginning, I wanted to handle both a
name that was form-input and one that was supplied by the link, so I
put this in the heading:

<HEAD><TITLE>Go d Loves <?php $name = $_POST['name']; if ($name == "")
$name = $HTTP_GET_VARS["name"]; $file = substr($name,0, 1) . "/" . $name
.. ".gif"; if (strnatcasecmp( $name,"con")) $file = "c/con-.gif"; echo
$name; ?>, a solvable puzzle personalized with <?php echo $name; ?>'s
name</title>
</head>

Hope I did it right.

Then when I wanted to echo the name as text:

<h1>God Loves <?php echo $name; ?></h1>

and when I wanted to echo the file name, either

<img src="<?php echo $file; ?>.gif">
or
<img src="<?php echo $file; ?>.gif" width="100%">

One question that occurred to me when I was playing with the header is
if the system remembers the variables between links to the page?

In other words, once $name = $_POST['name']; returns a value, is it
going to continue having a value even when another link might be used?
If so, should I be emptying the value with $_POST['name'] = "" after I
retrieve the value?

John

P.S. Just in case Brent doesn't have PHP installed, what should I tell
him about where to download it. You said it was free.

Jul 23 '05 #15
John <Go************ ******@gmail.co m> wrote:
page at www.GodLovesEveryone.org/godloves.php

When I try it in Mozilla Thunderbird, I'm getting asked if I want to
save the file to disk.


That's because the server is sending the page as

Content-Type: application/octet-stream

rather than as

Content-Type: text/html
--
Darin McGrew, da***@TheRallye Club.org, http://www.TheRallyeClub.org/
A gimmick car rallye is not a race, but a fun puzzle testing your
ability to follow instructions. Upcoming gimmick car rallye in
Silicon Valley: Common Sense (Saturday, April 2)
Jul 23 '05 #16
In article <11************ **********@l41g 2000cwc.googleg roups.com>,
Go************* *****@gmail.com enlightened us with...

I've left a message for him to call back. Meanwhile, I've put a test
page at www.GodLovesEveryone.org/godloves.php

When I try it in Mozilla Thunderbird, I'm getting asked if I want to
save the file to disk.
That one got answered. The server isn't sending the right content type. It
needs configured.

Whitespace is your friend. :)
And just use GET, not POST. No need for POSTing.
That way people can just send it in the URL, links, etc. Forms can use GET to
send stuff, too. POST is a way forms send data, mostly, and it should really
be used only when you're going to be doing things like updating a database.
GET is fine (and GET is what it is when it's in the URL).

And don't use the word "file" as a variable name. I shouldn't have -- I
wasn't thinking.
It's a reserved word (actually, it's a function) in PHP and you can
inadvertently do things you don't mean to. Best to not call variable names
the same as reserved words, even if a language allows it.

This is better (though I might even change "$name" to "$firstname " or
something).
Note the shortcut for echoing a variable value or expression is <?= varname
?>.

Watch for word wrap.

<html><head>
<?php
$name = $HTTP_GET_VARS["name"];
if ($name == "")
{
$name = "John"; // change to some default
}
$filename = substr($name,0, 1) . "/" . $name . ".gif";
if (strnatcasecmp( $name,"con")) $filename = "c/con-.gif"; /* not sure why you
have this here, what it does. */
?>
<title>God Loves <?= $name ?>, a solvable puzzle personalized with
<?= name ?>'s name.</title>
</head>
<body>

<h1>God Loves <?php echo $name; ?></h1>
<h1>God Loves <?= $name ?></h1>
(note, when using shortcut echo, NO SEMI-COLON.)

and when I wanted to echo the file name, either

<img src="<?php echo $file; ?>.gif">
You already had the .gif in there.
<img src="<?= $filename?>">

Note that the path was made as relative (j/john), so you have to have a
subdir under where this file is running from matching that.
i.e.
www.GodLovesEveryone.org/godloves.php
www.GodLovesEveryone.org/j/john.gif

One question that occurred to me when I was playing with the header is
if the system remembers the variables between links to the page?
Only if you save them as session variables (requires cookies on client) or
pass them via the URL or other means. IOW, you have to set it up to do that.
Otherwise, no, they aren't saved.

P.S. Just in case Brent doesn't have PHP installed, what should I tell
him about where to download it. You said it was free.


http://www.php.net

One tip - PHP generates dynamic HTML. Tracing problems is often hard --
unless you remember to view the HTML source with the browser's View->Source.
Sometimes you find easy mistakes (like misspelled directories) there. First
place to look when it doesn't seem to do what you thought it would. B/c the
browser doesn't normally see PHP. All it sees (all it is supposed to see) is
the html generated by your script.

--
--
~kaeli~
A little rudeness and disrespect can elevate a meaningless
interaction to a battle of wills and add drama to an
otherwise dull day.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #17
I found out why PHP doesn't work.

Brent says he doesn't host PHP because it's mainly a UNIX product, and
each time he has attempted to run PHP, it has crashed his Windows
server.

He suggested that I try to use either ASP or CFM, so any advice in
those areas would be appreciated. Meanwhile, I'll see what I can find
on a web search.

Regarding why I have "con-.gif", it's because, for some strange reason,
Windows won't let me have a file with "Con" as the filename, probably
because "CON" is a reserved word, standing for CONSOLE when doing a
display to the console, as in
COPY filename CON: /b

John

Jul 23 '05 #18
I've got a page mocked up in ASP that lets the user put in his name

http://www.godloveseveryone.org/godloves2.asp

But I haven't figured out how to do it with URL links, can you glance
at it and give me some advice. I did figure out how to capitalize the
first letter of the name, and took care of that funny "Con" error.

Here is what I ended up with, since I know you can't see it on the web
page.

Here's the first part of the file:

<%@ LANGUAGE="VBSCR IPT" %>

<% Dim First
Dim FilNam
First = Request.form("f irst")
if First="" then First="John"
First = ucase(left(Firs t,1))+mid(First ,2)
FilNam = left(First,1)+"/"+First+".g if"
if ucase(First)="C ON" then FilNam="C/Con-.gif"
%>
<HTML><HEAD>
<TITLE>God Loves <%=First%>, a solvable puzzle personalized with
<%=First%>'s name</title>
</head>

and the first H1 and image link

<h1>God Loves <%=First%></h1>
<img src="<%=FilNam% >">

and the large image link

<img src="<%=FilNam% >" width="100%">

I'm guessing that you might be able to help me with passing parameters
with the URL??? I also couldn't figure out how to test to see if the
file existed. DIR$ is the function I'm used to, I couldn't find either
it or anything starting with file like in your File_Exists example.

I do appreciate all your help, even all the "wasted time" on PHP helped
me get this one done much faster.

By the way, I didn't think your name was there, but I tested the page
with KAELI and guess what popped up? Hope that's a small thank you.

John

Jul 23 '05 #19
Hi, Kaeli,

In addition to the page that is "mostly working", I'm trying to work on
a slightly different version to strip out spaces and other
non-dash-non-letter characters from the filename, and possibly display
two mazes if they happen to put in a name with a space, first and all.

BUT I'm getting page not found, and getting no errors at all when I try
to load that particular page. Here is the ASP code if you can see
what's causing the error. I've tried breaking down the statements,
changing OR to +, and a few other strange things, so I may have made it
worse.

Here it is:

<%@ LANGUAGE="VBSCR IPT" %>

<% Dim First
Dim FilNam
Dim FilNam2
Dim i
Dim j
Dim FilNam3
Dim FilNam4
First = trim(Request.fo rm("first"))
if First<"A" then First="John"
if First>"zza" then First="John"
First = ucase(left(Firs t,1))+mid(First ,2)
FilNam = left(First,1)+"/"+First+".g if"
if ucase(First)="C ON" then FilNam="C/Con-.gif"
FilNam2 = left(First,1)+"/"+left$(First,i nstr(First+" "," ")-1)+".gif"
for i=len(FilNam)-4 to 3 step -1
j=asc(ucase(mid (FilNam,i,1)))
if j<>45 then
if (j<65)+(j>90) then FilNam=left(Fil Nam,i-1)+mid(FilNam,i +1)
end if
next
if FilNam2<>FilNam then
FilNam3="<img src="+chr$(34)+ FilNam2+chr$(34 )+"><P>"
FilNam4=left$(F ilNam3,len(FilN am3)-4)+" width=100%><P>"
end if
%>
<HTML><HEAD>
<TITLE>God Loves <%=First%>, a solvable puzzle personalized with
<%=First%>'s name</title>
</head>
<BODY><CENTER >
... snip ...
<Table bgcolor=#ffff77 ">
<TR><TD align=center>
<form action="godlove s3.asp" name="form" method="post">
<BIG>Make a Maze</big><BR>
containing<BR>
<I><B>Your</b></i> name:<BR><input type="text" size=15 name="first"
/>
<p><input type="submit" value="Make My Maze">
</form>
<B><font size=3 color=#FF0000>& nbsp;Now</font> <font size=2> more
than</font> <font color=#ff0000 size=3>38,000&n bsp;</font><BR>differ ent
names</b></font>
</td></tr></table>
... snip ...
<h1>God Loves <%=First%></h1>
<img src="<%=FilNam% >"><P>
<%=FilNam3%>
... snip ...
<h1>God Loves <%=First%></h1>
... snip ...
<%=FilNam4%>
<img src="<%=FilNam% >" width="100%">

the occurrence of <%=FilNam3%> and 4%> should, most of the time, just
result in a null string, but when the user puts in "JOHN WILLIAM" for
example, it should attempt to load both "JOHN" and "JOHNWILLIA M" .

I'm flummoxed, and I have to get up early tomorrow for an important
meeting (keep me in your prayers, it's an important meeting), so I'm
quitting now.

Meanwhile, I'm very grateful for the help. I have already linked the
new page to my main web page, www.GodLovesEveryone.org, so the page
that is working that you helped me with is now available
(www.GodLovesEveryone.org/godloves2.asp).

The page that isn't working is www.godloveseveryone.org/godloves3.asp

Thanks again.

John

Jul 23 '05 #20

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

Similar topics

3
2354
by: Mark Horton | last post by:
I thought would be a super simple project, but I was wrong. I need Help!!!! I am using the Word.Application.Mailmerge.OpenDataSource to try and send a Dynamic Query to my stated Document.Open File. For the life of me I cannot fiqure out how to pass a parameter from this code to the "Proposal" Query in the Access Front End. If I do not add the param variable then everthing works fine except that it pulls all of the matching records...
9
11373
by: Martoon | last post by:
I want to instantiate an STL map with my own compare function, and I want to pass a parameter to the compare function that will be stored and used for all comparisons in that map instance. As an example, let's say the map key is char* strings, and I want the comparison based on the nth character in the string. When the map is instantiated, I need to somehow specify n. So I might have something like this: class MyClass
2
20457
by: Dud Bug | last post by:
I have a query in an Access db that prompts the user for info. (e.g. a primary key representing a company) before compiling the relevant table of results. This works fine in Access but I want to use this query from within VB.Net. But how do I, in code, pass a parameter to the Access query?
2
2014
by: indhu | last post by:
hi all, Any idea of how to pass image value to shape. i ve 10 image boxes with differnt color gif associated to each image box. when i click image that color has to reflect in shape. pls help me in this. thanks in advance
3
2419
by: Angus | last post by:
I have a program which when downloaded from a server downloads another program from the same web server and then configures the downloaded program. The trouble is I have to hard code in the program the URL to download the other program from. So I need to work out how I can do the same thing without having a hard coded URL in the file. It is an executable generated from a C compiler so I don't want customers to have to edit a C source...
3
7349
by: John Dalberg | last post by:
I have seen examples for List<T>.FindAll(findthis)where findthis is a predicate. How do I pass a parameter to this predicate so that I have different values to search for? I don't want to use global variables.
13
12841
polymorphic
by: polymorphic | last post by:
I need to pass a parameter to an executable either via URL or link or script or whatever but nothing is working. The .exe is: \\CL001\Mart\OP2\Test1.exe The parameter is: '\\CL001\mart\op2\Test' A direct type of this in the URL works: \\CL001\Mart\OP2\Test1.exe /p '\\CL001\mart\op2\Test'
2
8517
by: | last post by:
I have a gridview with a textbox in an ItemTemplate, as below. The OnTextChanged event fires okay but how do I pass a parameter to it, I get an error when I try "OnTextChanged(""SomeData"")". I would also like to pass in the value of column 1. I would also like to be able to get the row the user is on when this event fires. Thank you for your help. <asp:GridView ID="gv" /> <Columns> <asp:BoundField DataField="Col1"...
6
2075
by: Max | last post by:
i have a event bind function like this(though it is not so robust): bind$=function(o,evt,fn,cb){ var aE='attachEvent'; var aEL='addEventListener'; if(!o&&o){ return o(evt,fn,!!cb); } return o('on'+evt,fn); };
1
9363
by: Jorge | last post by:
On Oct 23, 10:36 am, Tuxedo <tux...@mailinator.comwrote: Yes: function first_function (PARAMETER) { preload_image = new Image(800,600); preload_image.onload = function () { photo_preloaded(PARAMETER); }; preload_image.src = 'images/photo.jpg'; }
0
9583
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
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
10210
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
10039
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...
0
9860
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...
1
7406
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
5297
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3955
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 we have to send another system
2
3560
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.