1

Topic: I wrote a script

Hey,
This is the first script i've ever wrote that has functionality, it's pretty simple, I'm just posting it here so you guys can give me some feedback, i know i'm probably not doing things as efficiently as possibly. Anyways, here's the code if you'd like to critisize or off any helpful hints.

This is config.php

<?php

$title             = "Stewy's Pictures";             
$gallery_name    = "Scenery";

$scriptname     = $_SERVER["PHP_SELF"];        // Do not edit this.

$pic_suffix        = "pic";            // 

// All these are relative to the base directory
$thumb_dir         = "small";            // Directory where your thumbnails are stored
$regular_dir     = "medium";            // Directory where the regular size pics will be stored
$fullsize_dir     = "large";            // Directory where fullsize pics are stored.

$cols                 = '5';            // The number of columns you want
$number_of_pictures = '15';            // The number of pictures in your album
$picture_alignment     = 'center';     // pictures should be named in the following format: pic##.jpg, EX: pic01.jpg, pic02.jpg... etc.
$thumbwidth         = '100';        // The width of your thumbnails, this should ideally match the actually thumbnail width ~ 100px.
$preview_cell_width = '175';         // The width of the previous and next panes
$width                 = '410';         // The width of the reg size pictures.

// Array of comments, these will be displayed under your pictures, 
// 01 will match picture 01 and so on, if you need to add more
// add them using the same pattern.
$comments = array(
"01"    => "Argentia, NF.",
"02"    => "The Falls at Flatrock, NF.",
"03"    => "The Ocean at Flatrock, NF.",
"04"    => "Logy Bay, NF.",
"05"     => "Placentia, NF.",
"06"    => "Signal Hill, NF.",
"07"    => "Horseshoe Canyon, AB.",
"08"    => "Hot Air Balloon",
"09"    => "Lake Louise, AB. in winter",
"10"     => "Lake Louise, AB. in summer",
"11"    => "Moraine Lake, AB. in summer",
"12"    => "Moraine Lake, AB. in winter",
"13"    => "Fort Amherst, St. John's, NF.",
"14"    => "St. John's Harbour 1st View",
"15"    => "St. John's Harbour 2nd View",
);

$next     = $picture + 1;             // Setting up our next value (Do not edit)
$prev     = $picture - 1;             // Setting up previous value (Do not edit)
$next     = sprintf("%02d",$next);     // This line adds a leading zero to $next. (Do not edit)
$prev     = sprintf("%02d",$prev);     // This line adds a leading zero to $prev. (Do not edit)

?>

2

Re: I wrote a script

weird, everytime i try and post the rest of the code it leads me to a page that says precondition failed

What does this mean?

Re: I wrote a script

theres a bug on the forum atm http://punbb.org/forums/viewtopic.php?id=5342 and http://punbb.org/forums/viewtopic.php?id=5339

Re: I wrote a script

Hey stewy,

I'd been interested to see the rest of the code once the bug is straightened away.

I know all those NF places, being a townie myself by birth smile It's great to find a fellow Newfoundlander here!

5 (edited by stewy 2004-12-17 18:45)

Re: I wrote a script

holy cow, this is crazy!

well, the code works fine actually, i just figured that it could be written in a clearer or better way, since this is the first thing i've ever done in php... or at least the most involved.

you can see the script in action here

I've saved the code as textfiles:
config.txt is here and
index.txt is here

The indentation is a bit off, but the code's there.

If anyone would like to comment, that would be great.