Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have a directory... /opt/apache 1

Status
Not open for further replies.

Flipster

MIS
Jun 25, 2001
38
0
0
US
I have a directory...
/opt/apache_1.3.26/htdocs/blah/plots
...full of image files (.png files produced by gnuplot)Currently I just browse to the directory and view them one by one. I would like to automatically view them on one web page. I update the image files every minute or so, if that matters. Any help?
 
#!/bin/sh

parent="/opt/apache_1.3.26/htdocs/blah/plots/*png"

echo "
<html>
<head>
<title>My Image page</title>
<script>
function grabImage(name) {
open(name,\&quot;Image window\&quot;, height=400, width=200);
return true;
}
</script>
</head>
<body align=left>
<table align=left border=2 bgcolor=black bordercolor=white <caption>My Images</caption>>&quot;
i=1
for all in `ls $parent`
do
i=`expr $i + 1`
echo &quot;<tr><td rowspan=15 align=center><br><br>
<form name=\&quot;$i\&quot;>
<input type=image src=$all name=\&quot;$i\&quot; onClick=grabImage($all) height=80 width=50>
</form>
<br><br></td>&quot;
done
echo &quot;
</tr></table></body></html>
&quot;
 
Fair warning:
I just killed X with this trying to open
the resulting(huge)page with some sample
images I have so I haven't been able to test the javascript.
 
Ok...so what do I do with this script. I mean where do I place it. How does it get executed? Bear with me, please.
 
OK...I have to get out of the habit of letting other people do all of the thinking. I executed it and put the output to an .html file. I browsed to it and found 7 boxes (the same number of images---some success) but the images are not displayed they are merely black boxes crowded next to each other with a red x in them. Any ideas?
 
The javascript definitely does not work..
and the revised script looks like this:
#!bin/sh

parent=&quot;/opt/apache_1.3.26/htdocs/blah/plots/*png&quot;

echo &quot;
<html>
<head>
<title>My Image page</title>
<script>
function grabImage(name) {
var newwin;
newwin =window.open(\&quot;\&quot;,\&quot;Image window\&quot;, height=400, width=200);
newwin.document.writeln('<html><body align=center>');
newwin.document.writeln('<image src=\&quot;+ name +\&quot;></image>');
newwin.document.writeln('<br><form name=closer>');
newwin.document.writeln('<input type=button value=Close onClick=window.close()></form>');
newwin.document.writeln('</body></html>');
}
</script>
</head>
<body align=left>
<table align=left border=2 bgcolor=black bordercolor=white <caption>My Images</caption>>
<tr>&quot;
i=1
for all in `ls $parent`
do
i=`expr $i + 1`
echo &quot;<td rowspan=15 align=center><br><br>
<form name=\&quot;$i\&quot;>
<input type=image src=$all name=\&quot;$i\&quot; onClick=grabImage($all) height=80 width=50>
</form>
<br><br></td>&quot;
done
echo &quot;
</tr></table></body></html>
&quot;

About your problem..take a look at the doc source and see if the image paths are correct..probably you will have to change the parent variable to point to
the proper directory or amend the script so it finds the images.

As I said the javascript is for show right now, it doesn't work. Maybe somebody over at the js forum could
help, or you can just forget it and serve the images at a uniform size in their respective table niches.

Good Luck
 
Fixed, I'm really done now ;)

#!/bin/sh

parent=&quot;/opt/apache_1.3.26/htdocs/blah/plots/*png&quot;

echo &quot;
<html>
<head>
<title>My Image page</title>
<script>
function grabImage(name) {
var newwin;
newwin =window.open(\&quot;\&quot;,\&quot;Image window\&quot;, height=400, width=200);
newwin.document.writeln('<html><body align=center>');
newwin.document.writeln('<image src='+ name +' height=400 width=200 align=center></image>');
newwin.document.writeln('<br><form name=closer>');
newwin.document.writeln('<input type=button value=Close onClick=window.close()></form>');
newwin.document.writeln('</body></html>');
}
</script>
</head>
<body align=left>
<table align=left border=2 bgcolor=black bordercolor=white <caption>My Images</caption>>
<tr>&quot;
i=1
for all in `ls $parent`
do
i=`expr $i + 1`
echo &quot;<td rowspan=15 align=center><br><br>
<form name=\&quot;$i\&quot;>
<input type=image src=$all name=\&quot;$i\&quot; onClick=grabImage(\&quot;$all\&quot;) height=80 width=50>
</form>
<br><br></td>&quot;
done
echo &quot;
</tr></table></body></html>
&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top