Jump to content


Photo

Loading Images not working


  • Please log in to reply
3 replies to this topic

#1 perezf

perezf
  • Members
  • PipPipPip
  • Advanced Member
  • 301 posts
  • LocationFort Lauderdale

Posted 23 May 2006 - 01:37 PM

<?php $dir = realpath("photos/");
if (is_dir($dir)) {
if($dh=opendir($dir)) {
while(($file=readdir($dh))!=false) {
if(substr($file,0,1)!=".") echo "<img src=\"".$file."\"><br>".$file."<br><br>\n";
}
closedir($dh);
}
} else echo "Folder error. Try using ".realpath(".")." as a starting point."; ?>



what i am trying to do is load the images from the photos folder


#2 michaellunsford

michaellunsford
  • Members
  • PipPipPip
  • Advanced Member
  • 1,023 posts
  • LocationLouisiana, USA

Posted 23 May 2006 - 02:26 PM

For future reference, you should really continue the discussion in your original topic.

Anyway, "not working" isn't very specific. Are you getting errors? does the folder you're using not contain images? does it contain more than images?

#3 perezf

perezf
  • Members
  • PipPipPip
  • Advanced Member
  • 301 posts
  • LocationFort Lauderdale

Posted 23 May 2006 - 02:27 PM

[!--quoteo(post=376347:date=May 23 2006, 10:26 AM:name=michaellunsford)--][div class=\'quotetop\']QUOTE(michaellunsford @ May 23 2006, 10:26 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
For future reference, you should really continue the discussion in your original topic.

Anyway, "not working" isn't very specific. Are you getting errors? does the folder you're using not contain images? does it contain more than images?
[/quote]

it does not load anything when i specify the folder
but if i dont specify it then it works

#4 michaellunsford

michaellunsford
  • Members
  • PipPipPip
  • Advanced Member
  • 1,023 posts
  • LocationLouisiana, USA

Posted 23 May 2006 - 02:31 PM

if you use that code inside your pictures folder, use the "." instead of "pictures/". If you're using it in "pictures" parent folder, then you need to tell it "pictures".




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users