Reputation: 183
I did the php code for displaying the images that available in the folder. When I am run the code the image can't be displayed whereas the image holding place to be taken by the browser. Hereby I have mentioned my code kindly any one help what mistake I did. Thanks. If it is possible to share php code for displaying the images that available in the folder?
$files = glob("/home/aspire/Downloads/*");
for ($i=0; $i<count($files); $i++)
{
$num = $files[$i];
echo $num."<br>";
echo '<img src="'.$num.'" alt="Here should be image" width="256" height="192" >'." <br>"."<br>";
}
Upvotes: 1
Views: 109
Reputation: 35572
use glob
as
glob("/home/aspire/Downloads/"."*.jpg");
OR
glob("/home/aspire/Downloads/"."*.*");
and make sure that the path is correct
Upvotes: 2
Reputation: 1009
Where is this script located?
You should prepend variable $num in echo '<img src="'.$num.'"
with relative path to the image file.
If your PHP Script is located in /home/aspire the displaying code will look like this:
echo '<img src="Downloads/'.$num.'"
...`
Upvotes: 1