I have some problem in displaying images after reading them from a folder in php. Im displaying them using echo "...." to display. The problem is that I can see their names on my page e.g. 1.jpg etc... but instead of images a ripped page icon is being shown. I'm working in linux so Ive granted all rights to all users. Ive read this normally occurs when images are not uploaded which doesn't apply to my situation.
$folder = '/var/www/pics/'."$usern".'/';
$filetype = '*.*';
$files = glob($folder.$filetype);
echo '<table>';
for( $i=0; $i<count($files); $i++)
{
echo '<tr><td>';
echo '<a name="'.$i.'" href="#'.$i.'"><img src="'.$files[$i].'"/></a>';
echo substr($files[$i],strlen($folder),strpos($files[$i], '.')-strlen($folder));
echo '</td></tr>';
}
echo '</table>';
Note: $usern is the name of the folder whose images are being accessed.
You're refering your images to a server folder. Which is server-side (duh). You need to point it towards your relative webpage path.
For example: Folder needs to be:
$folder = "http://www.yourdomain.com/pics/$usern/";