943,514 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 2641
  • PHP RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Jul 11th, 2008
0

Re: Urgent requirement of image gallery in php

thanks for reply nil,i have done that but still iam getting error
thanks in advance
Reputation Points: 21
Solved Threads: 29
Posting Whiz in Training
praveen_dusari is offline Offline
202 posts
since Jun 2008
Jul 11th, 2008
0

Re: Urgent requirement of image gallery in php

its just a notice not an error. the script should still work. just change your error reporting to not show notices.
Reputation Points: 235
Solved Threads: 193
Nearly a Posting Virtuoso
kkeith29 is offline Offline
1,315 posts
since Jun 2007
Jul 11th, 2008
1

Re: Urgent requirement of image gallery in php

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.
Reputation Points: 11
Solved Threads: 1
Newbie Poster
Sanjay Sahu is offline Offline
5 posts
since Jul 2008
Jul 11th, 2008
0

Re: Urgent requirement of image gallery in php

Reputation Points: 11
Solved Threads: 1
Newbie Poster
Sanjay Sahu is offline Offline
5 posts
since Jul 2008
Jul 11th, 2008
2

Re: Urgent requirement of image gallery in php

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.
PHP Syntax (Toggle Plain Text)
  1. if($curr_dir == "")
  2. {
  3. $curr_dir = 'images';
  4. }

Cheers.
Attached Files
File Type: php photoalbum.php (3.5 KB, 24 views)
File Type: php disp_image.php (1.2 KB, 25 views)
Reputation Points: 28
Solved Threads: 19
Junior Poster
vicky_rawat is offline Offline
137 posts
since Jun 2008
Jul 11th, 2008
0

Re: Urgent requirement of image gallery in php

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.
Reputation Points: 8
Solved Threads: 2
Junior Poster in Training
nil_gh_80 is offline Offline
64 posts
since Aug 2007
Jul 11th, 2008
0

Re: Urgent requirement of image gallery in php

Hi Nil,

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

I think you uncommented the following line
PHP Syntax (Toggle Plain Text)
  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.
Reputation Points: 28
Solved Threads: 19
Junior Poster
vicky_rawat is offline Offline
137 posts
since Jun 2008
Jul 11th, 2008
0

Re: Urgent requirement of image gallery in php

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
Reputation Points: 21
Solved Threads: 29
Posting Whiz in Training
praveen_dusari is offline Offline
202 posts
since Jun 2008
Jul 11th, 2008
0

Re: Urgent requirement of image gallery in php

Hi Shanti,

I have included the files that matches exactly your requirements in my earlier posts.
Reputation Points: 28
Solved Threads: 19
Junior Poster
vicky_rawat is offline Offline
137 posts
since Jun 2008
Jul 11th, 2008
0

Re: Urgent requirement of image gallery in php

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
Reputation Points: 137
Solved Threads: 162
Posting Virtuoso
Shanti C is offline Offline
1,641 posts
since Jul 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Looking For A Partner
Next Thread in PHP Forum Timeline: ERROR: supplied argument is not a valid MySQL result resource





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC