Originally posted by Johnny
perl is fine. but where do I put in my html design there? I don't see any where to put it.
Just edit the header and footer, then you can put your design.
Originally posted by Johnny
perl is fine. but where do I put in my html design there? I don't see any where to put it.
#!/usr/bin/perl
use CGI qw(:standard);
my $imageDIR = qq($ENV{'DOCUMENT_ROOT'}/path/to/image/dir);
my $imageURL = qq([url]http://www.yourdomain.com/path/to/image/dir[/url]);
my @image_ext = ("jpg","jpeg","jpe","gif");
my $called_image = param('image');
print "Content-Type: text/html\n\n";
&header;
chdir($imageDIR);
if(-f $called_image) {
print qq(
<IMG SRC="$imageURL/$called_image">
);
} else {
print "Could not find your image";
}
&footer;
sub header {
print qq(
<HTML>
<HEAD><TITLE>My images</TITLE></HEAD>
<BODY>
Header<P>
);
}
sub footer {
print qq(
<P>Footer<P>
</BODY>
</HTML>
);
}
__END__
Originally posted by Johnny
so u telling me.. if I want to mine look like "http://www.amazinghumor.com/p.shtml?0261.jpg "
Then I have to do alot of hard work with that header and footer?
sub header {
print qq(
<HTML>
<HEAD><TITLE>My images</TITLE></HEAD>
<BODY>
Header<P>
);
}
sub footer {
print qq(
<P>Footer<P>
</BODY>
</HTML>
);
}
Originally posted by is0lized
just make a normal layout, and where you would normaly put the content, put the image
<html>
<head>
<title>
Title
</title>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<center>
CONTENT HERE
</center>
</body>
</html>
<html>
<head>
<title>
Title
</title>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<center>
</center>
</body>
</html>
just change the header/footer html around the php code [the code inside the <? ?> tags] to your liking. i just used the bare-bones html layout for the example.Originally posted by Johnny
how do i edit it so that I would have my own html design? cause this is just a plain page with the image you call out.
<?
include("/path/to/header.php");
if (file_exists("$DOCUMENT_ROOT/images/$QUERY_STRING")) {
?>
<img src="/images/<? echo("$QUERY_STRING"); ?>" border="2"><br>
<?
}
else {
?>
<b>No such image.</b><br>
<?
}
include("/path/to/footer.php");
?>
nope, the images directory is embedded in the php code... you can put the php file anywhere you want.Originally posted by Johnny
And on that site they had "http://www.weezerfans.com/rock/discs/sayitaintso.jpg"
that is where the image is at.. but the script "http://www.weezerfans.com/images/discs.php" is here.. aren't they suppose to be in teh same dir?
Originally posted by keith
just change the header/footer html around the php code [the code inside the <? ?> tags] to your liking. i just used the bare-bones html layout for the example.
or, like someone else had posted:PHP:<? include("path/to/header.php"); if (file_exists("$DOCUMENT_ROOT/images/$QUERY_STRING")) { ?> <img src="/images/<? echo("$QUERY_STRING"); ?>" border="2"><br> <? } else { ?> <b>No such image.</b><br> <? } include("path/to/footer.php"); ?>
nope, the images directory is embedded in the php code... you can put the php file anywhere you want.
#!/usr/bin/perl
use CGI qw(:standard);
my $imageDIR = qq($ENV{'DOCUMENT_ROOT'}/path/to/image/dir);
my $imageURL = qq([url]http://www.yourdomain.com/path/to/image/dir[/url]);
my $trackerDB = qq(tracker.db);
my $called_image = param('image');
my $action = param('action');
print "Content-Type: text/html\n\n";
&header;
if($action eq "show_image") { &show_image; }
elsif($action eq "show_downloads") { &show_downloads; }
else { print "What are you doing?"; }
sub show_image {
if(-f "$imageDIR/$called_image") {
&add_downloads;
print qq(
<IMG SRC="$imageURL/$called_image">
);
} else {
print "Could not find your image $called_image";
}
}
sub add_downloads {
open(TRACKER,"$trackerDB");
while(<TRACKER>) {
chomp;
($filename,$downloads) = split(/\|/,$_);
if($filename eq $called_image) {
$newdownloads = $downloads + 1;
$write .= "$filename|$newdownloads\n";
$found = 1; #If the record is found in the database, set to one
} else {
$write .= "$_\n";
}
}
close(TRACKER);
$newrecord = "$called_image|0";
open(TRACKER,">$trackerDB");
print TRACKER $write;
if(!$found) {
print TRACKER "$newrecord\n"; #If the record could not be found in the database, add a new record
}
close(TRACKER);
}
sub show_downloads {
open(TRACKER,"$trackerDB");
@record = <TRACKER>;
close(TRACKER);
foreach (@record) {
chomp;
($filename,$downloads) = split(/\|/,$_);
print qq($filename has been downloaded $downloads times<BR>);
}
}
sub header {
print qq(
<HTML>
<HEAD><TITLE>My images</TITLE></HEAD>
<BODY>
Header<P>
);
}
sub footer {
print qq(
<P>Footer<P>
</BODY>
</HTML>
);
}
&footer;
__END__