2

in php i want to ask how to get images one by one from folder directory and display in the jquery slider i have tried this php code by it's not working as i want?

 <ul class="jcarousel-list">
 <li class="jcarousel-item">
 <?php 
 $directory = "data/uploads/topslider/";
 if (glob($directory . "*") != false)
 {
   $filecount = count(glob($directory . "*"));
 }
 else
 {
 } 
 $files_index = glob("data/uploads/"."top"."slider/*.*");
 for ($i=0; $i<$filecount; $i++)
 {
   $num2 = $files_index[$i];
 ?>
 <img src="<?php echo $num2;?>" width="50" height="50" alt="" /> <? 
 }?></li>
 </ul>

i want display like this:

Image1 Imag2 Image3......and So On from single folder or directory

David
  • 19,577
  • 28
  • 108
  • 128
  • Take a look at ' Loop code for each file in a directory' http://stackoverflow.com/a/6155564/1089331 and see if it may help your request. – William Isted Feb 28 '13 at 00:07
  • Apart from any other issues, I expect the carousel needs each image in its own `
  • ` tag, and you are not looping in the right place, so that is a main issue to fix.
  • – Raad Feb 28 '13 at 00:15
  • Also, please expand on 'it's not working as i want'. Is the code returning any looped image html? And if so, is $num2 being set as expected from the PHP? – William Isted Feb 28 '13 at 00:16
  • @WilliamIsted and raad thanks to all it's working now what i want i got it ... Kit Grose gave me working solution –  Feb 28 '13 at 00:19