I have a folder with pics and I need to use scandir() to show all images in a html file. But scandir returns, for example, "image.jpg1". Why? How can I do that withouth problems?

Try:

$f=scandir('/Images/');
foreach($f as $p)
{
 echo '<img src="/Images/'.$p.'" />';
}

try the improve of hielo.

$f=scandir('/Images/');
foreach($f as $p)
{
  if($p=="." || $p=="."){
}
else{
 echo '<img src="/Images/'.$p.'" />';
}}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.