Urgent requirement of image gallery in php

Reply

Join Date: Jun 2008
Posts: 171
Reputation: praveen_dusari is an unknown quantity at this point 
Solved Threads: 21
praveen_dusari's Avatar
praveen_dusari praveen_dusari is offline Offline
Junior Poster

Re: Urgent requirement of image gallery in php

 
0
  #11
Jul 11th, 2008
thanks for reply nil,i have done that but still iam getting error
thanks in advance
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 1,227
Reputation: kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about kkeith29 has a spectacular aura about 
Solved Threads: 167
kkeith29's Avatar
kkeith29 kkeith29 is offline Offline
Nearly a Posting Virtuoso

Re: Urgent requirement of image gallery in php

 
0
  #12
Jul 11th, 2008
its just a notice not an error. the script should still work. just change your error reporting to not show notices.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 5
Reputation: Sanjay Sahu is an unknown quantity at this point 
Solved Threads: 0
Sanjay Sahu's Avatar
Sanjay Sahu Sanjay Sahu is offline Offline
Newbie Poster

Re: Urgent requirement of image gallery in php

 
1
  #13
Jul 11th, 2008
i got this error:
Notice: Undefined index: dir in imggallery.php on line 112
$curr_dir = $_REQUEST['dir'];
Last edited by Sanjay Sahu; Jul 11th, 2008 at 6:40 am.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 5
Reputation: Sanjay Sahu is an unknown quantity at this point 
Solved Threads: 0
Sanjay Sahu's Avatar
Sanjay Sahu Sanjay Sahu is offline Offline
Newbie Poster

Re: Urgent requirement of image gallery in php

 
0
  #14
Jul 11th, 2008
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 133
Reputation: vicky_rawat is an unknown quantity at this point 
Solved Threads: 17
vicky_rawat's Avatar
vicky_rawat vicky_rawat is offline Offline
Junior Poster

Re: Urgent requirement of image gallery in php

 
2
  #15
Jul 11th, 2008
Hi Friends,

Good news, I have modified the script somewhat more.now it supports
1. moving in directory ans subdirectories.
2. moving up the directory
3. slide show of the images.

just edit the following code and replace the "images" with the directory you want your photo album to start with.
  1. if($curr_dir == "")
  2. {
  3. $curr_dir = 'images';
  4. }

Cheers.
Attached Files
File Type: php photoalbum.php (3.5 KB, 8 views)
File Type: php disp_image.php (1.2 KB, 8 views)
Vivek Rawat
Keep solving complexities.
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 64
Reputation: nil_gh_80 is an unknown quantity at this point 
Solved Threads: 0
nil_gh_80's Avatar
nil_gh_80 nil_gh_80 is offline Offline
Junior Poster in Training

Re: Urgent requirement of image gallery in php

 
0
  #16
Jul 11th, 2008
okk friends use this code this is just modified and runnig fantastically.......


<style>
td{font: 12px Arial; color: #333333;}
</style>

<script language=javascript>
function clicked(val)
{
location.href = "rec_dir_list.php?dir="+val;
}
</script>

<html>
<title>Foto Album</title>
<body>
<?php
//level variable will hold 1 or 0, depending on if the directory has only files.
//1 - if sub-folders are still there
//0 - if only image files are there.

function list_images($imgdir,$level)
{
$imgdir = 'images/'; // the directory, where your images are stored
$allowed_types = array('png','jpg','jpeg','gif'); // list of filetypes you want to show
$dimg = opendir($imgdir);
$imgfile = readdir($dimg);
while($imgfile = readdir($dimg))
{

if(in_array(strtolower(substr($imgfile,-3)),$allowed_types))
{
$a_img[] = $imgfile;
sort($a_img);
reset ($a_img);
}
}
$totimg = count($a_img); // total image number
if($totimg > 0)
{
echo '<center><table><tr>';
for($x=0; $x < $totimg; $x++)
{
$size = getimagesize($imgdir.'/'.$a_img[$x]);
$halfwidth = ceil($size[0]/4);
$halfheight = ceil($size[1]/4);
if($x % 4 == 0 && $x != 0)
{
echo '</tr><tr>';
}
echo '<td><table border=1><tr><td><img src="'.$imgdir.'/'.$a_img[$x].'" width='.$halfwidth.' height='.$halfheight.'></td></tr></table></td>';
if($level==1)
{
break;
}
}
if($totimg%4 == 0)
{
echo '</table>';
}
else
{
echo '</tr></table>';
}
}
else
{
echo '<center><table><tr><td>No Images found</td></tr></table>';
}
}

function recur_dir($dir)
{
$flag=0;$ind=1;
$dirlist = opendir($dir);
echo '<center><table bgcolor=#eeeeee width="30%"><tr>';
while ($file = readdir ($dirlist))
{
if ($file != '.' && $file != '..')
{
$newpath = $dir.'/'.$file;
$level = explode('/',$newpath);
if (is_dir($newpath))
{
$ind += 1;
$flag = 1;
echo "<td>";
echo '<center><table><tr><td>';
list_images($dir.'/'.end($level),1);
echo '</td></tr><tr><td align=center>';
echo '<a href=javascript<b></b>:clicked("'.$dir.'/'.end($level).'")>'.end($level).'</a>';
echo '</td></tr></table>';
echo "</td>";
}
}

}
if($flag==0)
{
echo "<td>";
list_images($dir,0);
echo "</td></tr><tr><td><hr>Current Dir: ". $dir;
echo "</td></tr></table>";
}
else
{
echo "</tr><tr><td colspan=".$ind." align=center><hr>Current Dir: ". $dir;
echo "</td></tr></table>";
}
closedir($dirlist);


}
$curr_dir = $_REQUEST['dir'];
if($curr_dir == "")
{
$curr_dir = './images';
}
recur_dir($curr_dir);
?>
</body>
</html>

but you people must create a folder 'images' exactly where you keep this page with some images..
Last edited by nil_gh_80; Jul 11th, 2008 at 7:15 am.
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 133
Reputation: vicky_rawat is an unknown quantity at this point 
Solved Threads: 17
vicky_rawat's Avatar
vicky_rawat vicky_rawat is offline Offline
Junior Poster

Re: Urgent requirement of image gallery in php

 
0
  #17
Jul 11th, 2008
Hi Nil,

Can you please let me know, what modificatio you have made.

I think you uncommented the following line
  1. $imgdir = 'images/'; // the directory, where your images are stored

if yes, then this will make this code to work in only one level.
I have made this script to work in more then one levels.
Vivek Rawat
Keep solving complexities.
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 171
Reputation: praveen_dusari is an unknown quantity at this point 
Solved Threads: 21
praveen_dusari's Avatar
praveen_dusari praveen_dusari is offline Offline
Junior Poster

Re: Urgent requirement of image gallery in php

 
0
  #18
Jul 11th, 2008
hi vicky sorry for trouble,
i have a images in 'images folder' and images2
as sub folder when i click on sub folder iam getting images in actual 'imagesfolder'
thanks again
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 133
Reputation: vicky_rawat is an unknown quantity at this point 
Solved Threads: 17
vicky_rawat's Avatar
vicky_rawat vicky_rawat is offline Offline
Junior Poster

Re: Urgent requirement of image gallery in php

 
0
  #19
Jul 11th, 2008
Hi Shanti,

I have included the files that matches exactly your requirements in my earlier posts.
Vivek Rawat
Keep solving complexities.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 1,072
Reputation: Shanti Chepuru is on a distinguished road 
Solved Threads: 98
Shanti Chepuru's Avatar
Shanti Chepuru Shanti Chepuru is offline Offline
Veteran Poster

Re: Urgent requirement of image gallery in php

 
0
  #20
Jul 11th, 2008
Originally Posted by vicky_rawat View Post
Hi Shanti,

I have included the files that matches exactly your requirements in my earlier posts.
Its gud..
Very thanks for your time...

But i got this error..
Notice: Undefined variable: a_img in E:\web\test\photoalbum.php on line 39
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC