View Full Version : image gallery script
andy
February 19th, 2001, 22:46
Hi,
Does anyone know any script that automatically create HTML file for each photo? I have over 5000 pix, and don't want to make HTML file for each photo. Thank you
keith
February 20th, 2001, 00:36
php or perl?
Weapon
March 3rd, 2001, 04:34
Yeah I am looking for one to preferred cgi perl, any ideas?
keith
March 6th, 2001, 19:15
if you'd need it in php, i use something like that for the discography and images sections at http://www.weezerfans.com
just lemme know... not too well versed in perl though.
Canuckkev
March 7th, 2001, 20:03
I have one that I made/copy&pasted from other scripts. All you do is link to view.cgi?variable=pathtoimage . It can handle more variables too, like for me, I have 4 folders: 640, 800, 1024, 1152. You can go to view.cgi?wp=name&size=1024 to load the image from the 1024 folder. Also, I implemented a little coding that can print html from a txt file in a folder you specify. So for example, if you had a picture that you wanted a caption for, just name the .txt file to the same as the picture(before the .jpg), then when you load the page from the script, it will load the capion. Hmmm...I sense no make. I'll paste the script here:
#!/usr/bin/perl
print "Content-type:text/html\n\n";
use CGI;
$cgi = new CGI;
#the variable pairs after the view.cgi?
#it will store view.cgi?wp=XXX as the variable $wp
#same for the size
$wp = $cgi->param("wp");
$size = $cgi->param("size");
#Path to the header and footers
$headfile = 'txt/header.txt';
$footfile = 'txt/footer.txt';
#will retrieve the file txt/XXX.txt if your query string is
#view.cgi?wp=XXX
$detailsfile = 'txt/$wp.txt';
# Get the heading information
unless (open (DATA,"$headfile")) {die (&error);}
if ($uselock eq '1') {
flock DATA, 2;
seek DATA, 0, 0;
}
@headinfo = <DATA>;
if ($uselock eq '1') {
flock DATA, 8;
}
close (DATA);
foreach $headline (@headinfo){
$heading = $heading.$headline;
}
# Get the footer information
unless (open (DATA,"$footfile")) {die (&error);}
if ($uselock eq '1') {
flock DATA, 2;
seek DATA, 0, 0;
}
@footinfo = <DATA>;
if ($uselock eq '1') {
flock DATA, 8;
}
close (DATA);
foreach $footline (@footinfo){
$footer = $footer.$footline;
}
# Get the caption information
unless (open (DATA,"txt/$wp.txt")) {die (&error);}
if ($uselock eq '1') {
flock DATA, 2;
seek DATA, 0, 0;
}
@detailsinfo = <DATA>;
if ($uselock eq '1') {
flock DATA, 8;
}
close (DATA);
foreach $detailsline (@detailsinfo){
$details = $details.$detailsline;
}
print "$heading";
print "$details";
#this will load the image
#remove the $size slash if all images are in same
#directory, then replace with path to directory
print "<img src='$size/$wp.jpg'>";
print "$footer" ;
That should work, unless I messed it up with the comments.
keith
March 17th, 2001, 14:14
here's a much smaller, efficient way. you must have a php enabled web server though.
make a file called 'images.php3' that looks something like this [used on my site]:
<html>
<head>
<title><?php print "$caption" ?></title>
</head>
<body background="/img/bg.jpg" text="#ffffff">
<center>
<table cellpadding="15" cellspacing="0" border="0">
<tr>
<td align="center" bgcolor="#000070" background="/img/dkblue.gif">
<font face="arial" size="2"><b>
<img src="/rock/pics/<?php print "$image" ?>/<?php print "$image" ?><?php print "$number" ?>.jpg"><br>
<font size="1"><br></font>
<?php print "$caption" ?><br>
</b></font>
</td>
</tr>
</table>
</center>
</body>
</html>
with this example, the file would be called by http://www.weezerfans.com/images.php3?image=weezer&number=01&caption=AP+Photo
in my case, i have image files with the format weezerfans.com/rock/pics/weezer/weezer01.jpg
so the variable 'image' takes the place of the directory [/weezer] and the name of the file excluding the digits. then the variable 'number' takes the place of the number included with the image.
weezerfans.com/rock/pics/ <-- embedded in the html
weezer <-- image variable [?image=weezer]
/ <-- embedded in the html
weezer <-- image variable [?image=weezer]
01 <-- number variable [&number=01]
.jpg <-- embedded in the html
the caption in my case is used below the image and as the page title.
all you've gotta do is play around with the variables and html, and have it look any way you want.
pk
March 18th, 2001, 11:04
i made one using PHP. take a look at my website.
Powered by vBulletin® Version 4.1.7 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.