\n"); Echo($images); If(!$image_close) { Echo("\n"); } Echo("
\n"; $j++; If(is_int($j / $table_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((!eregi("_thumb",$file)) && (in_array(file_ext($file),$show_files))) { //If the file has the ignore word in it, do not show the file. If(!eregi($ignore_word,$file)) { //If a thumb file dosen't exists, then try and make one. If($auto_thumb) { If(!file_exists($full_server.$album.$file_name."_thumb".$file_ext)) { If(!file_thumb($file,$full_server.$album,$file_name)) { $thumb_error .="Thumb for ".$files_path.$album.$file." could not be created.
"; } } } //Now, if there is a thumb file, display the thumb, else display the full images but smaller :(. If(file_exists($full_server.$album.$file_name."_thumb".$file_ext) OR file_exists($full_server.$album.$file_name."_thumb".$file_ext)) { $thumb="_thumb".$file_ext; } Else { $thumb=$file_ext; } //Make the html $remove=""; If($display_admin) { If($phAdmin==true) { $remove="\n\n"; $remove.="\n"; $remove.="\n"; $remove.="\n"; $remove.="\n"; } } If($drop_shadow) { //Cool drop shadow effect. $images .= "\n"; } Else { //Image border $images .= "\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 .=""; } } } } } } @closedir($dir); //Close the directory so the bugs don't get in and display some folders and images! Whew! What a workout! ?>
Error: Folder ".$_POST['albumname']." could not be created. Maybe the folder exists?"; } Else { $phmessage="Folder ".$_POST['albumname']." has been created!"; } } Else { $phmessage="No Album name entered!"; } //Upload Images! } Elseif($_POST['upload']) { If($_FILES['image']['name']) { If(!upload()) { $phmessage="Error: Image ".$_FILES['image']['name']." could not be upload. Probably a Chmod Error or file exists."; } Else { $phmessage="Image ".$_FILES['image']['name']." has been uploaded!"; } } Else { $phmessage="No File Selected"; } } Elseif($_POST['remove']) { If($_POST['file']) { If(!remove()) { $phmessage="Could not delete file, probably a premission error.."; } Else { $phmessage="The file has been removed."; } } Else { $phmessage="No filename was sent to be deleted..."; } } } } //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%"; } //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); } //My ever popular (Yeah right) function for image creation. function file_thumb($file,$album,$file_name) { global $thumb_width,$thumb_height,$jpg_quality; //Get the file extension! $file_ext=file_ext($file); //The GD Libary only supports jpg and gif really, well it can only make a gif a jpg. There are other ways like image magik, but not many have it so I didn't include that. So dent anything that isn't a gif or jpg :(. $Allow=array("jpg","gif","png"); If(in_array($file_ext,$Allow)) { //Lets do some converting! $imgdata=getimagesize($full_server.$album.$file); $imgresized=imagecreatetruecolor($thumb_width, $thumb_height); If($file_ext=="gif") { $imgsoruce=imagecreatefromgif($full_server.$album.$file); } Elseif($file_ext=="jpg") { $imgsoruce=imagecreatefromjpeg($full_server.$album.$file); } Elseif($file_ext=="png") { $imgsoruce=imagecreatefrompng($full_server.$album.$file); } Else { return false; } imagecopyresized($imgresized, $imgsoruce, 0, 0, 0, 0, $thumb_width, $thumb_height, $imgdata[0], $imgdata[1]); $new_file=$full_server.$album.$file_name."_thumb.".$file_ext; //PHP 4.4.X added safemode check which made me add this here.. $fh=fopen($new_file,'w'); fclose($fh); If($file_ext=="gif") { If(!imagegif($imgresized, $new_file)) { return false; } } Elseif($file_ext=="jpg") { If(!imagejpeg($imgresized, $new_file,$jpg_quality)) { return false; } } Elseif($file_ext=="png") { If(!imagepng($imgresized, $new_file)) { return false; } } imagedestroy($imgsoruce); imagedestroy($imgresized); return True; } return false; } //The tiny but powerfull ;) admin panel. function phadmin() { global $phmessage,$script_url,$album; If($phmessage) { Echo("
".$phmessage."

"); } ?>
Upload Image


Make New Album


\"Album ".$home_link." "; } Else { $nav="\"Album ".$home_link." "; } //How many paths do we got in $album? $count=@count($folder); //Lets make the naviation! 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])."\" ".ucwords($folder[$i])." "; } Else { $nav .=" > \"".ucwords($folder[$i])."\" ".ucwords($folder[$i])." "; } } } Echo($nav); //Lets get some images!! $dir=@opendir($full_server.$album); //Loop through them all ;). while($file=@readdir($dir)) { //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)) { //If the file has the ignore word in it, do not show the file. If(!eregi($ignore_word,$file)) { $display_name=str_replace($find,$replace,$file); //Make the html $folders .= "
\"".ucwords($display_name)."\"
".ucwords($display_name)."
\"".ucwords($display_name)."\"
".ucwords($display_name)."
".$remove."
\"".ucwords($display_name)."\"
".ucwords($display_name)."
".$remove."

\n"); Echo("
\n"); If($thumb_error && !$supress_error) { Echo("
The following thumb errors have occured:

".$thumb_error."
Maybe this is from the folder ".$files_path.$album." not being chmod 777.
"); } } Else { Echo("\n"); Echo("\n"); Echo(""); Echo("\n"); Echo("
No images to display in this album. Please pick another album.
\n"); } Echo("
\n"); Echo("
\n"); If($display_admin) { Echo("

\n"); If($phAdmin==true) { phadmin(); } Else { ?>