php - Display single picture from the webroot folder -


I am trying to display an image from the webroot folder: banner . Putting it in an array but what happens here, it is displaying two images with the same name.

My code is here:

  & lt; Div id = "banner-left-content" & gt; & Lt ;? Php $ ab [] = Array (); Foreach (Globe ('./banner / thumbs /*.*') as $ filename) {$ ab = array ($ filename); Foreign Currency ($ AB $ as $) {$ listImages [] = $ imagename; Echo "& lt; img src = '$ list images [0]' width = '200' height = '300' / & gt;"; }}? & Gt; & Lt; / Div & gt;    

Keep your echo image out of your foreach

 < Code> & lt; Div id = "banner-left-content" & gt; & Lt ;? Php $ ab [] = Array (); Foreach (Globe ('./banner / thumbs /*.*') as $ filename) {$ ab = array ($ filename); Foreign Currency ($ AB $ as $) {$ listImages [] = $ imagename; }} Echo "& lt; img src = '$ list images [0]' width = '200' height = '300' / & gt;"; ? & Gt; & Lt; / Div & gt;    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -