Ver Mensaje Individual
  #6 (permalink)  
Antiguo 28/03/2012, 23:10
anarkes
 
Fecha de Ingreso: noviembre-2007
Ubicación: Etzatlan, Jalisco
Mensajes: 50
Antigüedad: 16 años, 5 meses
Puntos: 18
Respuesta: problema al ordenar array

Si deseas mostrar el primer elemento del arreglo, solo es necesario usar

Código PHP:
Ver original
  1. <img style="CURSOR: hand" src="<?php echo $dir.$arreglo[0]; ?>"name="show" class="img">

Asi deberia de quedar el codigo original pero con scandir
Código PHP:
Ver original
  1. <?php
  2.  
  3.         if(is_dir($dir)){
  4.             $arreglo = scandir($dir);
  5.             foreach($arreglo as $file){
  6.                 if($file != '.' && $file != '..' && $file != "Thumbs.db"){
  7.                     if($i==0)
  8.                         $firstpic=$file;
  9.                     $i++;
  10.                     $filenames .= "'".$file."', ";
  11.                 }
  12.             }
  13.             echo substr($filenames, 0, -2);
  14.         }
  15.  
  16. ?>

Última edición por anarkes; 28/03/2012 a las 23:19