Current location: Hot Scripts Forums » Programming Languages » PHP » gallery script


gallery script

Reply
  #1 (permalink)  
Old 01-25-04, 06:20 AM
Emjay Emjay is offline
Newbie Coder
 
Join Date: Jan 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Post gallery script

Hi there,

I have a gallery script which working fine, but I cant figur out how to add the a dir, I have the gallery script in root and the pictures are in /gallery.

I have tried to change:
$handle=opendir('.');
to
$handle=opendir('galleri');

but it dosnt work...


anyone can help me out?
thanx in advance
Emjay

PHP Code:

<?



// NUMBER OF <TD> PER <TR> 
$td='3';
// BACKGROUND COLOR OF THE PAGE
$bg='#FFFFFF';
// SHOW THE NAME OF THE FILE?
$dir='galleri';
$name='1'// 1 = yes, 0 = no
// TITLE OF YOUR PAGE
$pagetitle='Galleri!. Click each one to see a larger image.';

// DIRECTORY NAME
$handle=opendir('.');

// GO
$piccy=array();
$count=0;
// SCAN THE DIR
while (($filename readdir($handle))!==false) {
   
// ADD IN EXTRA FILE TYPES HERE
   
if (substr($filename,-4) == ".jpg" || substr($filename,-4) == ".gif" || substr($filename,-4) == ".png" || substr($filename,-4) == ".JPG" || substr($filename,-4) == ".GIF" || substr($filename,-4) == ".PNG"  || substr($filename,-4) == ".BMP" || substr($filename,-4) == ".bmp"){
   if (
substr($filename,0,6) == "thumb_"){
    
$piccy[$count] = $filename;
    
$count++;
   }}}
// CLOSE DIR
closedir($handle);
// SORT THE FILES
sort($piccy);
reset($piccy);

// DISPLAY LARGE IMAGE
 
if ($large){

  echo 
'<div align="center">';
// IS NAME SELECTED TO SHOW?
  
if ($name=="1") {
      if (!(
file_exists($large))){
          echo 
"No file of that name is uploaded.";
          exit;
      }
      echo 
'<br><font color="#CC0000" face="verdana" size="1">Selected image: ' $large '</font>';}
// SHOW THE PICTURE
  
echo '<table width="30%" border=0 cellpadding=0 cellspacing=0>';
  echo 
'<tr>';
  echo 
'<td valign="middle" align="center"><a href=javascript:history.back(-1)><img src="'.$large.'" alt="'.$large.'" border=0></a></td>';
  echo 
'<br>';
  echo 
'</tr></table>';
  echo 
'<br><br>';
  echo 
'<a href=javascript:history.back(-1)>';
  echo 
'<font color="#CC0000" size="1" face="verdana">Back to the Thumbnail Gallery</font></a>';
        }
// NO LARGE PICCY, CREATE TABLE FOR THUMBNAILS:
else{
 
// start table, if you want cellpadding, cellspacing, colors, set them here
 
echo '<html><head><title> ::// Manan Galleri //::</title>';
 echo 
'<head>';
 echo 
"<body bgcolor=" $bg ">";
 echo 
'<div align="center"><font color="#CC0000" face="verdana" size="1">' $pagetitle '</font><br>';
 echo 
'<br><table width="30%" border=0 cellpadding=0 cellspacing=0>';
 echo 
'<tr>';
 
// BECAUSE THE <TD> IS SET BY USER, WORK OUT THE PERCENTAGES:
 
$divider=ceil(100/$td);
 if ((
$divider*$td)>100$divider--;
 
// GRAB THE IMAGES
 
for ($l=0;$l<=sizeof($piccy)-1;$l++){
  
$isend strpos((($l)/$td),".");
  if (!
$isend && ($l!=0)){echo "</tr>\n<tr><td colspan=$td><br></td></tr>\n<tr>\n";}
  if (
$l==0){echo "\n";}
  
// START THE <TD>
  
echo '<td width="'.$divider.'%" valign="middle" align="center">';
  
// GET THE LARGER PICTURE (IF SELECTED)
  
echo "<a href=\"$PHP_SELF?large=".substr($piccy[$l],6)."\">";
  
// DISPLAY THE THUMBNAILS
  
echo '<img src="'.$piccy[$l].'" alt="'.$piccy[$l].'" border=0></a><br><br>';
  
// IS NAME SELECTED TO SHOW?
  
if ($name=="1") {
  echo 
'<font color="#333333" face="verdana" size="1">' substr($piccy[$l],6) . '</font>';}
  echo 
'</td>';
  echo
"\n";}
  echo 
'</tr></table></div>';}

?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 01-25-04, 06:41 AM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
I think you don't need to change anything just move it to the dir you wanted ...
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 01-25-04, 06:48 AM
Emjay Emjay is offline
Newbie Coder
 
Join Date: Jan 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
I think you don't need to change anything just move it to the dir you wanted ...
Hi Nevermind
the script works if I have it in the same "dir" as images...but I want the images to be in gallery/ and the script in "root"

/gallery
script.php

thanx
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 01-25-04, 08:32 AM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
oh ..
I think you need to change $handle to either one of these because I am not sure :
PHP Code:

$handle=opendir('/galleri');

#     OR     #
$handle=opendir('./galleri'); 
you need this slash to tell that this is the child dir of root ...
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 01-25-04, 10:09 AM
Emjay Emjay is offline
Newbie Coder
 
Join Date: Jan 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
now it shows brokken image links and the names of image files in the "galleri" dir

hmm....strange

I cant see whats wrong here
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 01-25-04, 04:22 PM
Emjay Emjay is offline
Newbie Coder
 
Join Date: Jan 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
little correction to my first post:
the dir is called "galleri" and NOT "gallery"

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #7 (permalink)  
Old 01-25-04, 04:40 PM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
right click on one of the images and tell us what is the URL of the image !
I know it's a broken link, but it would help alot knowing where it's pointing ..
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #8 (permalink)  
Old 01-25-04, 05:06 PM
Emjay Emjay is offline
Newbie Coder
 
Join Date: Jan 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
NeverMind
its pointing to the root, same place as the script file.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


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

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
photographer gallery script omini Script Requests 7 10-22-04 01:47 PM
Is there any integrity of script rankings? webmaster@atmanager.com Hot Scripts Forum Questions, Suggestions and Feedback 17 08-06-04 01:12 AM
Seeking for a simple photo gallery script... Sgrebs PHP 0 10-27-03 03:00 PM
Adding one script to another? Guestbook to gallery Pvasoldier PHP 1 09-25-03 07:02 PM
Gallery script, can someone check the programming? Pvasoldier PHP 10 09-25-03 06:43 PM


All times are GMT -5. The time now is 05:31 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.