//================================================================================
//* ! ATTENTION !
//================================================================================
//:- Please read the above FAQ before giving up or emailing me. It may sort out your problems!
$album_title="Cam Album"; //The name of this album
$home_link="Home"; //The home link
$open_folder="./phopen.gif"; //The open folder image
$close_folder="./phclose.gif"; //The closed folder image
//$big_folder="./phfolder.gif"; //The big folder image
$big_folder="./Cimg.gif"; //The big folder image
//$script_url=$_SERVER['PHP_SELF']; //Change this if you want to use this as an include file.
$files_path="../ArchivioCam/"; // Where does the album start? Anything under the directory the script will read. With Trailing slash
$full_server="../ArchivioCam/"; //Enter the full server path to where the albums start. //With Trailing Slash
$show_files=array("jpg","gif","png"); //The array, only show these types of files.
$ignore_word="-hide"; //Hide files with this string in the name. Example, mypicture-hide.jpg will not be shown.
$table_cells="1"; //How many images/folders in each row do you want? // Looks best with 3
$folder_cells="6";
$thumb_width="878"; //Width of the thumb
$thumb_height="700"; // Height of the thumb
//$auto_thumb="0"; //Automatically create thumb's of gif and jpg images? 1=yes, 0=no. REQUIRES GD LIBRARY
$jpg_quality="100"; // JPG thumb quality, does not work for png or gif. 0=low, 100=highest.
$supress_error="0"; //Suppress errors if thumb creation fails. 1=hide errors, 0=show errors.
$text_color="#868284"; // The text color.
$text_size="10"; // The text size.
$text_face="Verdana, Arial, sans-serif"; //The text face. Arial, Verdana etc.
//$link_color="#868284"; // The link color.
//$link_hover="#FFFFFF"; // Link link hover color, you know, when you put your mouse over a link!
$link_hover="#293134";
$error_color="#FF0000"; //Color for error messages
//$bgcolor="#293134"; // Page background color.
$drop_shadow="1"; //Use the cool css drop shadow around the images? 1=yes, 0=no.
$shadow_strength="1"; //How much do you want the shadow to show? Increase this value for more.
$shadow_direction="135"; //1 to 360. Changes where the light is coming from.
$shadow_color="grey"; //The shadow color.
$image_border="2"; //Do you want a border around the images? 1-10, number of pixels.
$border_color="#000000"; // What color do you want the image border to be?
/*
//================================================================================
* Attention
//================================================================================
: Don't edit below this line unless you know some php. Editing some variables or other stuff could cause undeseriable results!!
: This is no joke, I spent lots of time trying to work through everything, this is why I have so many comments in the file.
*/
//We need this to be here so we can cookie before we echo.
//Header html.. for css etc.
?>
//Start the album script! Lets get it started in here!
//Makes the tables look nice and pretty.
If($table_cells=="1") {
$cell_width="100%";
} Elseif($table_cells=="2") {
$cell_width="50%";
} Elseif($table_cells=="3") {
$cell_width="33%";
} Elseif($table_cells=="4") {
$cell_width="25%";
} Elseif($table_cells=="5") {
$cell_width="20%";
} Elseif($table_cells=="6") {
$cell_width="16%";
} Else {
$cell_width="10%";
}
If($folder_cells=="1") {
$Fcell_width="100%";
} Elseif($folder_cells=="2") {
$Fcell_width="50%";
} Elseif($folder_cells=="3") {
$Fcell_width="33%";
} Elseif($folder_cells=="4") {
$Fcell_width="25%";
} Elseif($folder_cells=="5") {
$Fcell_width="20%";
} Elseif($folder_cells=="6") {
$cell_width="16%";
} Else {
$Fcell_width="10%";
}
//This is just a random ignore word if none is set above, pretty impossible to be in the filename anyways.
If(!$ignore_word) {
$ignore_word=microtime();
}
//A bit tricky, but all in all it works, returns the filename without the extension!
function file_name($key) {
$key=strrev(substr(strstr(strrev($key), "."), 1));
return($key);
}
//Lets get the file extension.
function file_ext($key) {
$key=strtolower(substr(strrchr($key, "."), 1));
$key=str_replace("jpeg", "jpg", $key);
return($key);
}
//Get the current album.
$album=stripslashes(str_replace(".","",$_GET['album'])); //Great security here.. Disallows going up the dir tree.
//Lil bit of security, not much but it may stop some kids from messing!
If(!is_dir($files_path.$album)) {
$album="";
}
//We don't want ugly _'s or -'s to display with the file or folder names do we? No! So, lets take them out.
$find=array("_","-");
$replace=array(" "," ");
//############################# DISPLAY THE ALBUM###########################
//Boom! Splits the $album var into a readable array!
$folder=@explode("/",$album);
If($album) {
$nav=" ".$home_link." ";
} Else {
$nav=" ".$home_link." ";
}
//How many paths do we got in $album?
$count=@count($folder);
//Lets make the naviation! Don't look if you have a weak stomache!
for($i=0;$i<$count;$i++) {
If($folder[$i]) {
$path.=$folder[$i]."/";
//Give all the folders except the last folder a link and a closed picture.
If(($count-2) > $i) {
$nav .=" > ".ucwords($folder[$i])." ";
} Else {
$nav .=" > ".ucwords($folder[$i])." ";
}
}
}
Echo($nav);
$dir=@opendir($full_server.$album);
//Loop through them all ;).
$files = array();
while($files[]=readdir($dir));
sort($files);
closedir($dir);
foreach ($files as $file){
//Don't display the stupid directory tree files.
If($file!= "." AND $file!= "..") {
//If it's a directory, show the folder image with a link to the new album
If(is_dir($full_server.$album.$file) AND $file !="") {
//If the file has the ignore word in it, do not show the file.
If(!preg_match("-hide-i",$file)) {
$display_name=str_replace($find,$replace,$file);
//Make the html
$folders .= " ".ucwords($display_name)." | \n";
$j++;
If(is_int($j / $folder_cells)) { //This makes the table all nice and neat, actually, it splits the table with a new every $table_cells images/folders.
$folders.= "
\n\n";
$folder_close="1";
} Else {
$folders.="";
}
}
// Else, the file is not a directory, so it must be an image.
}
Else {
$file_ext=".".file_ext($file);
$file_name=file_name($file);
$display_name=str_replace($find,$replace,$file_name);
//Hide the thumb files from displaying as regular files and disallow any file types that are not allowed.
If((!preg_match("-_thumb-i",$file)) && (in_array(file_ext($file),$show_files))) {
//If the file has the ignore word in it, do not show the file.
If(!preg_match("-hide-i",$file)) {
//Now, if there is a thumb file, display the thumb, else display the full images but smaller :(.
$thumb=$file_ext;
//Make the html
$remove="";
If($drop_shadow) {
//Cool drop shadow effect.
$images .= "".ucwords($display_name)." ".$remove." | \n";
} Else {
//Image border
$images .= " ".ucwords($display_name)." ".$remove." | \n";
}
$k++;
If(is_int($k / $table_cells)) { //This makes the table all nice and neat, actually, it splits the table with a new
every $table_cells images/folders.
$images .= "
\n\n";
$image_close="1";
} Else {
$images .="";
}
}
}
}
}
}
//Close the directory so the bugs don't get in and display some folders and images! Whew! What a workout!
?>
If($folders) {
Echo("\n");
Echo("\n");
Echo($folders);
If(!$folder_close) {
Echo("
\n");
}
Echo("
\n");
Echo("
\n");
}
Echo("
\n");
If($images) {
Echo("\n");
Echo("\n");
Echo($images);
If(!$image_close) {
Echo("
\n");
}
Echo("
\n");
}
?>
//Please leave this here.. it really dosen't make people hate you or make your site look bad.. ?>