tutorials.de Buch-Aktion 05/2012
ERLEDIGT
NEIN
ANTWORTEN
1
ZUGRIFFE
165
EMPFEHLEN
  • An Twitter übertragen
  • An Facebook übertragen
AUF DIESES THEMA
ANTWORTEN
  1. #1
    hups1803 hups1803 ist offline Mitglied Gold
    Registriert seit
    Jan 2008
    Beiträge
    159
    hallo ,
    ich rufe mit diesen script meine Bilder im Ordner auf

    PHP-Code:
    function search4Picture$folder$picturelist = array() )
    {
        
    $dir dir($folder);
        while( 
    $file $dir->read() ) {
            if( 
    preg_match('/^\./'$file) ) continue;   // Eintrag mit . am Anfang
            
    $realpath sprintf"%s/%s"$folder$file );

            if( 
    is_dir($realpath ) ) {
                
    $picturelist search4Picture$realpath$picturelist );
            }


            if( 
    is_file($realpath) ) {
                
    $image_info getimagesize$realpath );
                switch( 
    $image_info] ) {
                    case 
    1:            // Type = gif
                    
    case 2:            // Type = jpeg
                    
    case 3:            // Type = png
                        
    $picturelist[] = $realpath;
                    break;
                    default:            
    // Type = kein Bild, also nix machen
                    
    break;
                }
            }
        }
        
    $dir->close();

        return 
    $picturelist;
    }

    $width='100';
    $height='100';
    $anzahl='27';
    $alleBilder search4Picture'galleries' );

        
    //<img src="/scripts/timthumb.php?src=/images/whatever.jpg&h=150&w=150&zc=1" alt="">  
        
    $i=0;
    foreach(
    $alleBilder AS $name)
       {
           if(
    $i<$anzahl)
       
       echo 
    '<img src="timthumb.php?src='.$name.'&h='.$height.'&w='.$width.'&zc=1"> ';
       
        else
            break;
         
    $i++; 
       } 
    nun habe ich aber kein plan wie ich die bilder sortieren könnte ich dachte an die sortierung abc der ordner

    kann mir mal bitte jemand helfen
     

  2. #2
    Ch Tutorials.de Gastzugang
    Hallo,
    in dem du dein "$picturelist" Array als index (Key) keinen Integer sondern einen eindeutigen Wert gibst z.B. filename. Danach kannst du mit z.B.

    PHP-Code:
    asort($picturelist);
    foreach (
    $picturelist as $key => $val) {
        echo 
    "$key = $val\n";

    dir die Dateien sortiert ausgeben lassen.
     

Ähnliche Themen

  1. Antworten: 4
    Letzter Beitrag: 15.10.07, 21:52
  2. List navigation mit Background Image
    Von UnoDosTres im Forum CSS
    Antworten: 3
    Letzter Beitrag: 13.07.07, 08:56
  3. Problem mit Image List
    Von codeman im Forum .NET Windows Forms
    Antworten: 0
    Letzter Beitrag: 25.12.05, 20:26
  4. list-style-image
    Von son gohan im Forum CSS
    Antworten: 3
    Letzter Beitrag: 23.07.05, 15:11
  5. list-style-image IE
    Von the real intruder im Forum CSS
    Antworten: 3
    Letzter Beitrag: 13.05.05, 10:20