Is someone who can help me; I'm trying to get an image from a folder and show it:
Here is my code, logos is the directory; the problem is that I'm getting only the name of the image!

$handle=opendir('../logos/'); 
   while (false!==($file = readdir($handle))) 
   { 
      if ($file != "." && $file != "..") 
      { 
      echo "".$file."\n"; 
      } 
   } 
   closedir($handle); 

Thanks

Recommended Answers

All 2 Replies

Surely you need to echo the path out in an img tag otherwise all you will do is read the name

e.g.

echo "<img src=\"logos".$file."\" alt=\"".$file."\" />

echo '<img src="../logos/' . $file . '" alt="' . $file . '" />';

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.