PHP Set image source for image tag -


i'm trying use php list of images in folder , display it. here current code:

$images = glob($volumepath."*"); foreach($images $image) {     $path = str_replace('c:\xampp\htdocs\\', '..', $image]);     $path2 = str_replace(' ', '%20', $path);     $file = "<img src=".$path2."/>";     echo $file; } 

right now, can retrieve array of images when try display it, shows generic placeholder image. how show image?

tested giving file path , shows doesn't work php.

try complete code:

$images = glob($volumepath."*"); foreach($images $key => $image) {     $path = str_replace('c:\xampp\htdocs\\', '../', $image);     $path2 = str_replace(' ', '%20', $path);     $file = "<img src='".$path2."'/>";     echo $file; } 

note single quotes in $file variable, modified foreach statement , single $image variable in $path


Comments

Popular posts from this blog

wireshark - USB mapping with python -

c++ - nodejs socket.io closes connection before upgrading to websocket -

Deploying Qt Application on Android is really slow? -