Go Back   Novahq.net Forum > phphq.Net > phphq.Net Forums
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-15-2004, 05:22 PM
Steve is offline Steve
Steve's Avatar
Administrator

Join Date: Sep 2001
Location: 2077
Posts: 21,552

Send a message via ICQ to Steve
great work

just tested this out and it's simply superb.
i think a lot of ppl could use this but don't know about it, so i'll spread the word.

it would be great for sig galleries etc :wink:

gj
Reply With Quote
  #2  
Old 08-16-2004, 06:10 AM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,922

ty sb
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
  #3  
Old 08-16-2004, 11:05 AM
PHP-Largo
Unregistered

Posts: n/a

yes gj
Reply With Quote
  #4  
Old 08-29-2004, 04:57 PM
Sniper Jo
Unregistered

Posts: n/a

PW?

What is the PW for the admin section. (ps sorry 4 being stupid) and GJ on it !
Reply With Quote
  #5  
Old 08-29-2004, 04:59 PM
Sniper Jo
Unregistered

Posts: n/a

Nevermind !!! i got it
Reply With Quote
  #6  
Old 08-29-2004, 05:02 PM
Sniper Jo
Unregistered

Posts: n/a

i'm back. It would be great if there was a delete feature !!
Reply With Quote
  #7  
Old 09-29-2004, 06:42 AM
petercbk
Unregistered

Posts: n/a

Delete Feature

I have added a delete feature using

// Delete image
elseif($_POST['del_img'])
{
$file_name=file_name($full_server.$album.$file);
$thumb_del = $file_name."_thumb.jpg<br>";
unlink($thumb_del);
unlink($full_server.$album.$file);
}

Which deletes the main image but not the thumb - and I just cannot see why not.

Can anyone help?

I'll post up the full code I'm using if anyone is interested. It also allows users to upload an html file that gives a story about their photos.
Reply With Quote
  #8  
Old 09-29-2004, 06:53 AM
petercbk
Unregistered

Posts: n/a

Delete Feature working

Solved my problem. Just remove the <br> - careless.

Btw, I've also added a delete and rename feature for folders.

If anyone is interested, let me know.

Excellent script, Scott - many thanks.
Reply With Quote
  #9  
Old 09-29-2004, 07:13 AM
peterc
Unregistered

Posts: n/a

Delete feature

I registered but couldn't find the login.

petercbk is registered user peterc: petercbk@mweb.co.za
Reply With Quote
  #10  
Old 09-29-2004, 07:23 AM
Dane
Unregistered

Posts: n/a

:d, keep visiting the forums, lets get more traffic hehe.

yeh scott is a good person, but also naughty for not telling me to restart my server lol. nm, have phun, keep posting.
Reply With Quote
  #11  
Old 09-29-2004, 09:48 AM
katana*GFR* is offline katana*GFR*

Join Date: May 2002
Location: North Sea
Posts: 2,421

Send a message via ICQ to katana*GFR* Send a message via MSN to katana*GFR*
Re: Delete feature

[quote:daa9873742="peterc"]I registered but couldn't find the login.

petercbk is registered user peterc: petercbk@mweb.co.za[/quote:daa9873742]

Login is at the bottom right

PS Can you post the full code for the photoalbum? I like to use it.
__________________
<- Sponsored by Chris



Found on Youtube:
Quote:
And if Newton Faulkner's voice can be described as "R&B" then Kurt Cobain must be a member of Boyz II Men.
Link here
Reply With Quote
  #12  
Old 09-29-2004, 11:18 AM
peterc
Unregistered

Posts: n/a

Here it is:

&lt;?
//error_reporting(0);
/*
//================================================== ==============================
* phphq.Net Custom PHP Scripts *
//================================================== ==============================
:- Script Name: phPhotoAlbum
:- Version: 1.0
:- Release Date: July 21st 2004
:- Author: Scott L. aka. Panther &lt;scott@phphq.net&gt; http://www.phphq.net
:- Copyright (c) 2004 All Rights Reserved
:-
:- This script is freeware. Permission is granted to copy and distribute this
:- program so long as it is not modified in any way and no fees are exchanged.
:- All copyright text must remain visible and unmodified.
//================================================== ==============================
* Description
//================================================== ==============================
:- phPhotoAlbum has got to be the easiest drag and drop photo album around.
It sports an easy customizable look, and very powerfull features.
:- With this one little file, you can make a whole photo album, very easily.
Have it creat thumbs for you on the fly. (Requires GD Library)
:- Features include, unlimited directory + sub-directory support, ignored files,
only show certain types, auto image resizeing if desired, and
:- simplicity. Plus it requires no database! All you need is this one little file.
All that you need to do to create your album,
:- is make folders and put images in them. The script does the rest.
How much simplier can it get? Well, it now comes with a simple
:- admin panel! You can make folders and upload images without your ftp client!
Now, it can't get any easier. You can also do it the
:- old fashin way with the ftp client if you like and turn the admin panel off!
Anyways, hope this script comes in handy!
//================================================== ==============================
* Setup
//================================================== ==============================
:- To setup this script, simply drop this file anywhere in your website.
Then edit the vars below.
//================================================== ==============================
* Frequently Asked Questions
//================================================== ==============================
:- Q1: The script wont make thumbnails! (Yes it will, but with your help).
:- A1: Make sure the folder in which the files are in is chmod 777.
Use your ftp client or site admin panel to do this.
:- A2: Make sure the file you want the script to make a thumb of is either jpg or gif.
This script will not make thumbs of any other file types.

:- Q2: I keep getting creating thumb errors.
:- A1: Maybe the folder is chmod 777. Please do this using your ftp client or
site admin panel.
:- A2: This script can only make thumbs of jpg or gif images. Any other image types
this script will fail to make images of.

:- Q3: I cannot upload files to the folders I created in the admin panel.
:- A1: Your server may have some security against the chmod() function.
You will have to chmod each folder 777 with your ftp client or site admin panel.
Sorry .
:- A2: The file type of the uploaded file must be in the $show_files array in the
settings of this script. Otherwise it will be denied.
*/

//Never know..

unset($phmessage);
unset($thumb_error);
unset($display_admin);

/*
//================================================== ==============================
* ! ATTENTION !
//================================================== ==============================
:- Please read the above FAQ before giving up or emailing me. It may sort out your problems!
*/
$album_title ="Emgee Workshop Photo Album"; //The name of this album
$home_link ="Emgee Workshop"; //The home link
$admin_username ="admin";
$admin_password ="password";
$display_admin ="1"; // Display the admin login form?
// If you select no, you will not be able to login!
// You will have to upload etc manually. 1=yes,0=no.

$open_folder ="./phopen.gif"; //The open folder image
$close_folder ="./phclose.gif"; //The closed folder image
$big_folder ="./phclose.gif"; //The big folder image
$script_url =$_SERVER['PHP_SELF']; // Change this if you want to use this as an include file.
$files_path ="./album/"; // Where does the album start?
// Anything under the directory the script will read.
// With Trailing slash

$full_server ="./album/"; // Enter the full server path to where the albums start.
// With Trailing Slash

$show_files =array("jpg","gif"); //The array, only show these types of image files.
$show_docs =array("htm","html"); //The array, only show these types of document files.
$ignore_word ="-hide"; //Hide files with this string in the name.
//Example, mypicture-hide.jpg will not be shown.

$table_cells ="4"; //How many images/folders in each row do you want?
// Looks best with 3

$dir_cell_width="15%";

$thumb_width ="175"; // Width of the thumb
$thumb_height ="115"; // Height of the thumb
$auto_thumb ="1"; // Automatically create thumb's of gif and jpg images?
// 1=yes, 0=no. REQUIRES GD LIBRARY

$MaxFileSize = "61440"; // max file size in bytes
$MaxHDDSpace = "20480000"; // max total size of all files in directory

$supress_error="0"; // Suppress errors if thumb creation fails.
// 1=hide errors, 0=show errors.

$text_color ="#000000"; // The text color.
$text_size ="9"; // The text size.
$text_face ="Verdana"; //The text face. Arial, Verdana etc.
$bgcolor ="#F8CD62"; // 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 session and cookie before we echo.
if($display_admin)
{
if($_POST['login'])
{
if(($_POST['password']=="$admin_password") &amp;&amp; ($_POST['username']=="$admin_username"))
{
$_SESSION['phAdmin']="$admin_username$admin_password";
setcookie("phAdmin","$admin_username$admin_passwor d",time()+3600);
header("Location: ".$script_url."?".$_SERVER['QUERY_STRING']);
exit;
}
}
if($_POST['logout']) {
$_SESSION['phAdmin']="";
setcookie("phAdmin","",time-300);
header("Location: ".$script_url."?".$_SERVER['QUERY_STRING']);
exit;
}
}

//Header html.. for css etc.
echo "
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;".$album_title."&lt;/title&gt;
&lt;style type='text/css'&gt;
body{background-color:".$bgcolor.";}
a:link {color:".$text_color.";}
a:visited {color:".$text_color.";}
.text{font-family:".$text_face."; font-size:".$text_size."; color:".$text_color."; font-weight:bold;}
.image {border:".$image_border."px solid ".$border_color.";}
input { font-family:".$text_face."; font-size:".$text_size."px; font-weight: bold; color:".$text_color."; border:1px solid ".$border_color."; background-color:".$bgcolor.";}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;center&gt;&lt;h2&gt;".$album_title."&lt;/h2&gt;&lt;/center&gt;
";

//Start the album script! Lets get it started in here!

//Check if the admin is here.
if($display_admin)
{
if($_SESSION['phAdmin']=="$admin_username$admin_password")
{
$phAdmin=True;
}
elseif($_COOKIE['phAdmin']=="$admin_username$admin_password")
{
$phAdmin=True;
}
else
{
$phAdmin=False;
}
}

//Only if the user is an admin can he $_POST this stuff!
if($display_admin)
{
if($phAdmin=="True")
{
//Make directories!
if($_POST['makedir'])
{
if($_POST['albumname'])
{
if(!makedir($_POST['albumname'], 0777))
{
$phmessage="&lt;font color='red'&gt;
Error: Folder ".$_POST['albumname']." could not be created.
Maybe the folder exists?&lt;/font&gt;";
}
else
{
$phmessage="&lt;font color='red'&gt;
Folder ".$_POST['albumname']." has been created!&lt;/font&gt;";
}
}
else
{
$phmessage="&lt;font color='red'&gt;No Album name entered!&lt;/font&gt;";
}
}
//Upload Images!
elseif($_POST['upload'])
{
if($_FILES['image']['name'])
{
if(filesize($image) &lt; $MaxFileSize)
{
if(dirsize($full_server) &lt; $MaxHDDSpace)
{
if(!upload())
{
$phmessage="&lt;font color='red'&gt;
Error: File ".$_FILES['image']['name']." could not be upload.
Probably an incorrect file type or the file already exists.&lt;/font&gt;";
}
else
{
$phmessage="&lt;font color='red'&gt;
File ".$_FILES['image']['name']." has been uploaded!&lt;/font&gt;";
}
}
else
{

$phmessage="&lt;font color='red'&gt;
File ".$_FILES['image']['name']." could not be upload.
The maximum server space for images (20 MB) has been reached.&lt;/font&gt;";
}
}
else
{
$phmessage="&lt;font color='red'&gt;
File ".$_FILES['image']['name']." could not be upload.
The file size is bigger than 60 kB.&lt;/font&gt;";
}
}
else
{
$phmessage="&lt;font color='red'&gt;No File Selected&lt;/font&gt;";
}
}
// Delete folder
elseif($_POST['del_dir'])
{
if(is_dir($full_server.$album))
{
$result = @rmdir($full_server.$album.$file);
if($result == 0)
{
echo $msg = "&lt;br&gt;&lt;center&gt;&lt;font face='Verdana, Arial, Hevetica' size='2' color='#ff0000'&gt;
The folder could not be deleted.
The folder must be&lt;br&gt;empty before you can delete it.
You also may&lt;br&gt;not be authorised to delete this folder.&lt;/font&gt;&lt;/center&gt;&lt;p&gt;";
}
}
else
{
unlink($path.$pathext.$delete);
}
}
// Delete image
elseif($_POST['del_img'])
{
$file_name=file_name($full_server.$album.$file);
$thumb_del = $file_name."_thumb.jpg";
unlink($thumb_del);
unlink($full_server.$album.$file);
}
// Delete document file
elseif($_POST['del_htm'])
{
unlink($full_server.$album.$file);
}
// Rename folder
elseif($_POST['change_name'])
{
// add characters to strip out of filenames
$snr = array("%","'","+","\\","/","#","..","!",'"',',','?','*','~');
$rename_to = strip_tags($rename_to);
$rename_to = str_replace($snr,"",$rename_to);
$nname = trim($rename_to);
$renamed = @rename ($files_path.$album."$oldname", $files_path.$album."$nname");
if($renamed&lt;1)
{
echo "&lt;font face='Verdana, Arial, Hevetica' size='2' color='#ff0000'&gt;
Rename process FAILED!&lt;br&gt;Check that the new name does not alrady exist.&lt;/font&gt;&lt;p&gt;";
}
else
{
echo "&lt;font face='Verdana, Arial, Hevetica' size='2' color='#ff0000'&gt;
Folder name successfully changed!&lt;/font&gt;&lt;p&gt;";
}
}
}
}

//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;

//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");
if(in_array($file_ext,$Allow))
{
//Lets do some converting!
$imgdata=@getimagesize($full_server.$album."/".$file);
$imgwidth=$imgdata[0];
$imgheight=$imgdata[1];

// (int)$resizedwidth=$thumb_width;
// (int)$resizedheight=$thumb_height;

$shrinkage = 1;
if ($imgwidth &lt; $imgheight)
{
$shrinkage = $thumb_height/$imgheight;
$resizedheight = $thumb_height;
$resizedwidth = $shrinkage * $imgwidth;
}
else
{
$resizedheight = $thumb_height;
$resizedwidth = $shrinkage * $thumb_width;
}

$imgresized=@ImageCreateTrueColor($resizedwidth, $resizedheight);
if($file_ext=="gif")
{
$imgsoruce=@ImageCreateFromGif($full_server.$album ."/".$file);
}
elseif($file_ext=="jpg")
{
$imgsoruce=@ImageCreateFromJpeg($full_server.$albu m."/".$file);
}
else
{
return false;
}
@ImageCopyResized ($imgresized, $imgsoruce, 0, 0, 0, 0, $resizedwidth, $resizedheight, $imgwidth, $imgheight);
if(!@ImageJpeg($imgresized, $full_server.$album.$file_name."_thumb.jpg"))
{
return false;
}
@ImageDestroy($imgsoruce);
@ImageDestroy($imgresized);
return True;
}
return false;
}

//The tiny but powerfull admin panel.
function phadmin()
{
global $phmessage,$script_url;
if($phmessage)
{
echo "&lt;div align='center' class='text'&gt;$phmessage&lt;/div&gt;&lt;br&gt;";
}
echo "
&lt;table border='0' class='text' width='67%' cellpadding='1' cellspacing='0' align='center'&gt;
&lt;tr&gt;
&lt;td align='center' colspan='2'&gt;Make New Album&lt;/td&gt;
&lt;td align='center' colspan='2'&gt;Upload Image&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;form method='POST' action='".$script_url."?".$_SERVER['QUERY_STRING']."'&gt;
&lt;td&gt;Name:&lt;/td&gt;
&lt;td&gt;
&lt;input type='text' name='albumname'&gt;
&lt;input type='hidden' name='makedir' value='makedird'&gt;
&lt;input type='submit' style='cursor:hand;' name='makedir' value=' Go! '&gt;&lt;br&gt;&lt;br&gt;&lt;/td&gt;
&lt;/form&gt;
&lt;form method='POST' action='".$script_url."?".$_SERVER['QUERY_STRING']."' enctype='multipart/form-data'&gt;
&lt;td valign='top'&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp ;nbsp;File:&lt;/td&gt;
&lt;td align='center'&gt;
&lt;input type='file' name='image' size='60'&gt;
&lt;input type='hidden' name='upload' value='upload'&gt;
&lt;input type='submit' style='cursor:hand;' name='upload' value=' Go! '&gt;&lt;br&gt;&lt;br&gt;&lt;/td&gt;
&lt;/form&gt;
&lt;/tr&gt;
&lt;form method='POST' action='".$script_url."?".$_SERVER['QUERY_STRING']."'&gt;
&lt;tr&gt;
&lt;td align='center' colspan='4'&gt;
&lt;input type='submit' style='cursor:hand;' name='logout' value=' Log me out! '&gt;&lt;/td&gt;
&lt;/form&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;hr size='1' color='".$text_color."'&gt;";
}

//Makes a directory
function makedir($key)
{
global $full_server,$album;
$key=str_replace(".","",str_replace("/","",$key));
if(!@mkdir($full_server.$album.$key))
{
return False;
}
@chmod($full_server.$album.$key,octdec("0777"));
return True;
}

/* calculate the size of files in $dir */
function dirsize($dir) {
$size = -1;
if ($dh = @opendir($dir)) {
while (($file = readdir($dh)) !== false) {
if ($file != "." and $file != "..") {
$path = $dir."/".$file;
if (is_dir($path)) {
$size += dirsize("$path/");
}
elseif (is_file($path)) {
$size += filesize($path);
}
}
}
closedir($dh);
}
return $size;
}

//Uploads the file to the current directory.
function upload()
{
global $full_server,$album,$show_files,$show_docs;

$key=$_FILES['image']['tmp_name'];
$name=$_FILES['image']['name'];
if(in_array(file_ext($name),$show_files))
{
if(!file_exists($full_server.$album.$name))
{
if(!move_uploaded_file($key,$full_server.$album.$n ame))
{
return False;
}
else
{
return True;
}
}
}
if(in_array(file_ext($name),$show_docs))
{
if(!file_exists($full_server.$album.$name))
{
if(!move_uploaded_file($key,$full_server.$album.$n ame))
{
return False;
}
else
{
return True;
}
}
}
return False;
}

//Get the current album.
//Great security here.. Disallows going up the dir tree.
$album=stripslashes(str_replace(".","",$_GET['album']));

//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###########################

if($display_admin)
{
echo("&lt;hr size='1' color='".$text_color."'&gt;");
if($phAdmin=="True")
{
phadmin();
}
else
{
echo "
&lt;form method='POST' action='".$script_url."?".$_SERVER['QUERY_STRING']."'&gt;
&lt;table border='0' cellpadding='1' width='600' class='text' align='center'&gt;
&lt;tr&gt;
&lt;td align='center'&gt;&lt;h5&gt;Admin Login Here:&lt;/td&gt;
&lt;td&gt;Username:&lt;/td&gt;
&lt;td&gt; &lt;input type='text' name='username' size='20'&gt;&lt;/td&gt;
&lt;td&gt;Password:&lt;/td&gt;
&lt;td&gt; &lt;input type='password' name='password' size='20'&gt;&lt;/td&gt;
&lt;td align='center'&gt;
&lt;input type='submit' style='cursor:hand;' name='login' value='Login'&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/form&gt;
&lt;hr size='1' color='".$text_color."'&gt;
";
}
}
echo "&lt;div align='right' class='text'&gt;
&lt;a href='http://www.emgeeza.com/catalog/index.php'&gt;
Back to Emgee Workshop
&lt;/a&gt;
&lt;/div&gt;";
//Boom! Splits the $album var into a readable array!
$folder=@explode("/",$album);

if($album)
{
$nav="&lt;a href='".$script_url."'&gt;
&lt;img src='".$close_folder."' border='0' align='absmiddle'&gt; ".$home_link."&lt;/a&gt;";
}
else
{
$nav="&lt;a href='".$script_url."'&gt;
&lt;img src='".$open_folder."' border='0' align='absmiddle'&gt; ".$home_link."&lt;/a&gt;";
}

//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&lt;$count;$i++)
{
if($folder[$i])
{
// $last=$i;
$path.=$folder[$i]."/";
//Give all the folders except the last folder a link and a closed picture.
if(($count-2) &gt; $i)
{
$nav .=" &gt;
&lt;a href='".$script_url."?album=".$path."'&gt;
&lt;img src='".$close_folder."' border='0' align='absmiddle'&gt; ".ucwords($folder[$i])."
&lt;/a&gt;";
}
else
{
$nav .=" &gt;
&lt;a href='".$script_url."?album=".$path."'&gt;
&lt;img src='".$open_folder."' border='0' align='absmiddle'&gt; ".ucwords($folder[$i])."
&lt;/a&gt;";
}
}
}

//if($folder[$last]) {
// $nav.=" &gt; &lt;img src='".$open_folder."' border='0' align='absmiddle'&gt; ".ucwords($folder[$last]);
//}
echo("&lt;font class='text'&gt;".$nav."&lt;/font&gt;");

//Lets get some images!!
$dir=@opendir($full_server.$album);

//Oops, you found it. Please don't touch or take this off,
//I worked very hard on this to make it simple and secure .
function cp()
{
global $text_face,$text_size,$text_color;
echo "
&lt;br&gt;
&lt;table border='0' width='98%'&gt;
&lt;tr&gt;
&lt;td align='right'&gt;
&lt;font style='font-face:".$text_face."; font-size:".$text_size."; font-color:".$text_color.";'&gt;
Powered By: &lt;a href='http://www.phphq.net/?script=phPhotoAlbum' target='_blank'&gt;&lt;b&gt;
phPhotoAlbum v1.0&lt;/b&gt;&lt;/a&gt;
&lt;/font&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
";
}

//Loop through them all .
while($file=@readdir($dir))
{
//Don't display the stupid directory tree files.
if($file!= "." &amp;&amp; $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
if($phAdmin=="True")
{
$show_rename_link = "
&lt;td&gt;
&lt;a href='".$script_url."?".$_SERVER['QUERY_STRING']."&amp;action=rename&amp;folder=".$file."'&gt;
Rename this Folder&lt;/a&gt;
&lt;/td&gt;";

$show_del_dir = "
&lt;form method='POST' action='".$script_url."?".$_SERVER['QUERY_STRING']."'&gt;
&lt;td width='15%'&gt;
&lt;input type='hidden' name='album' value='".$album.$file."'&gt;
&lt;input type='submit' style='cursor:hand;' name='del_dir' value=' Delete! '&gt;
&lt;/td&gt;
&lt;/form&gt;";

if ($action == 'rename')
{
$show_rename_things = "
&lt;form name='rename_form' method='POST' action='".$script_url."?".$_SERVER['QUERY_STRING']."'&gt;
&lt;td&gt;
&lt;input type='hidden' name='album' value='".$album."'&gt;
&lt;input type='hidden' name='oldname' value='".$file."'&gt;
&lt;input type='text' name='rename_to' value=''&gt;
&lt;input type='submit' style='cursor:hand;' name='change_name' value=' Rename! '&gt;
&lt;/td&gt;
&lt;/form&gt;";
}
}
$folders .= "
&lt;tr&gt;&lt;td width='".$dir_cell_width."' align='left' class='text' valign='middle'&gt;
&lt;a href='".$script_url."?album=".$album.$file."/'&gt;
&lt;img src='".$big_folder."' border='0'&gt;
".ucwords($display_name)."&lt;/a&gt;&lt;/td&gt;
".$show_del_dir.$show_rename_link.$show_rename_thi ngs."&lt;/tr&gt;";
$j++;
//This makes the table all nice and neat, actually,
//it splits the table with a new &lt;tr&gt; every $table_cells images/folders.
if(is_int($j / $table_cells))
{
$folders .= "&lt;/tr&gt;&lt;tr&gt;";
$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_nam e);
//Hide the thumb files from displaying as regular files and disallow any file types
//that are not allowed.
if((!eregi("_thumb",$file)) &amp;&amp; (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."_t humb".$file_ext))
{
if(!file_thumb($file,$full_server.$album,$file_nam e))
{
$thumb_error .="Thumb for ".$files_path.$album.$file." could not be created.&lt;br&gt;";
}
}
}
//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."_th umb".$file_ext) || file_exists($full_server.$album.$file_name."_thumb .jpg"))
{
$thumb="_thumb.jpg";
}
else
{
$thumb=$file_ext;
}

$thumb_data=@getimagesize($files_path.$album.$file _name.$thumb);
$thumbwidth=$thumb_data[0];
$thumbheight=$thumb_data[1];

if($phAdmin=="True")
{
$show_del_img = "
&lt;input type='hidden' name='album' value='".$album.$file."'&gt;
&lt;input type='submit' style='cursor:hand;' name='del_img' value=' Delete! '&gt;";
}

//Make the html
if($drop_shadow)
{
//Cool drop shadow effect.
$images .= "
&lt;form method='POST' action='".$script_url."?".$_SERVER['QUERY_STRING']."'&gt;
&lt;td width='".$cell_width."' align='center' class='text'&gt;
&lt;div style='width:".($thumb_width+20)."px;
height:".($thumb_height+20)."px;
filter:shadow(color:grey,strength:15, direction:135);'&gt;
&lt;a href='".$files_path.$album.$file."' target='_blank'&gt;
&lt;img src='".$files_path.$album.$file_name.$thumb."'
border='0'
width='".$thumbwidth."'
height='".$thumbheight."'&gt;
&lt;/a&gt;&lt;/div&gt;".ucwords($display_name).$show_del_img."&lt ;/td&gt;&lt;/form&gt;\n";
}
else
{
//Image border
$images .= "&lt;td width='".$cell_width."' align='center' class='text'&gt;
&lt;a href='".$files_path.$album.$file."' target='_blank'&gt;
&lt;img src='".$files_path.$album.$file_name.$thumb."'
border='0'
width='".$thumbwidth."'
height='".$thumbheight."'
class='image'&gt;
&lt;/a&gt;&lt;br&gt;".ucwords($display_name).$show_del_ img."&lt;/td&gt;\n";
}
$k++;
//This makes the table all nice and neat, actually, it splits the table with a
//new &lt;tr&gt; every $table_cells images/folders.
if(is_int($k / $table_cells))
{
$images .= "&lt;/tr&gt;&lt;tr&gt;";
$image_close="1";
}
else
{
$images .="";
}
}
}
else
{
if (file_ext($file) == 'htm' || file_ext($file) == 'html')
{
if($phAdmin=="True")
{
$show_del_htm = "&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;input type='hidden' name='album' value='".$album.$file."'&gt;
&lt;input type='submit' style='cursor:hand;' name='del_htm' value=' Delete! '&gt;";
}
echo "
&lt;form method='POST' action='".$script_url."?".$_SERVER['QUERY_STRING']."'&gt;
&amp;nbsp;&amp;nbsp;
&lt;img src='html.gif'&gt;
&lt;a href='".$files_path.$album.$file."' target='_blank' class='text'&gt;
".ucwords($display_name)."&lt;/a&gt;".$show_del_htm."&lt;/form&gt;";
}
}
}
}
}

@closedir($dir);

//Close the directory so the bugs don't get in and display some folders and images! Whew!
//What a workout!
echo "
&lt;table border='0' cellpadding='0' width='98%' class='text' align='center'&gt;
&lt;tr&gt;&lt;td&gt;".$navigation."&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;";

if($folders)
{
echo "&lt;table border='0' cellpadding='0' width='98%' class='text' align='center'&gt;";
echo "&lt;tr&gt;";
echo($folders);
if(!$folder_close)
{
echo "&lt;/tr&gt;";
}
echo "&lt;/table&gt;";
echo "&lt;hr size='1' color='".$text_color."'&gt;";
}
echo "&lt;br&gt;";
if($images)
{
echo "&lt;table border='0' cellpadding='15' width='98%' class='text' align='center'&gt;";
echo "&lt;tr&gt;";
echo($images);
if(!$image_close)
{
echo "&lt;/tr&gt;";
}
echo "&lt;/table&gt;";
if($thumb_error &amp;&amp; !$supress_error)
{
echo "&lt;div align='center' class='text'&gt;
&lt;font color='red'&gt;
The following thumb errors have occured:&lt;/font&gt;&lt;br&gt;&lt;br&gt;
".$thumb_error."&lt;br&gt;
Maybe this is from the folder ".$files_path.$album." not being chmod 777.&lt;/div&gt;";
}
}
else
{
echo "
&lt;table border='0' cellpadding='15' width='".$table_width."' class='text' align='center'&gt;
&lt;tr&gt;
&lt;td align='center' class='text'&gt;No images to display. Please pick another album.&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;";
}
echo "&lt;br&gt;";
echo "&lt;br&gt;";
echo "&lt;div align='right' class='text'&gt;
&lt;a href='http://www.emgeeza.com/catalog/index.php'&gt;
Back to Emgee Workshop
&lt;/a&gt;
&lt;/div&gt;";
echo "&lt;hr size='1' color='".$text_color."'&gt;";
cp();
?&gt;
Reply With Quote
  #13  
Old 09-29-2004, 02:36 PM
katana*GFR* is offline katana*GFR*

Join Date: May 2002
Location: North Sea
Posts: 2,421

Send a message via ICQ to katana*GFR* Send a message via MSN to katana*GFR*
cheers, im gonna test it tomorrow when i get back from guard duty
__________________
<- Sponsored by Chris



Found on Youtube:
Quote:
And if Newton Faulkner's voice can be described as "R&B" then Kurt Cobain must be a member of Boyz II Men.
Link here
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hello all! Great site! Megasaxon Feedback / Novahq.net Support 4 10-31-2008 11:14 AM
Laptop you think is great Hellfighter Hardware and Software 18 06-14-2008 10:21 AM
Great Place to Work..! bigsmellyfart Humor & Jokes 1 01-04-2006 05:55 AM
great sigs Himself Sigs and Graphics 11 10-12-2003 04:29 PM
A Great Server. BADDOG Delta Force 11 11-14-2002 07:38 PM


All times are GMT -5. The time now is 05:25 PM.




Powered by vBulletin®