ERLEDIGT
NEIN
NEIN
ANTWORTEN
1
1
ZUGRIFFE
165
165
EMPFEHLEN
-
hallo ,
ich rufe mit diesen script meine Bilder im Ordner auf
nun habe ich aber kein plan wie ich die bilder sortieren könnte ich dachte an die sortierung abc der ordnerPHP-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[ 2 ] ) {
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++;
}
kann mir mal bitte jemand helfen
-
04.01.12 18:55 #2Ch 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.
dir die Dateien sortiert ausgeben lassen.PHP-Code:asort($picturelist);
foreach ($picturelist as $key => $val) {
echo "$key = $val\n";
}
Ähnliche Themen
-
[c++] Problem mit STL (list, vector sort(),etc..)
Von radazong im Forum C/C++Antworten: 4Letzter Beitrag: 15.10.07, 21:52 -
List navigation mit Background Image
Von UnoDosTres im Forum CSSAntworten: 3Letzter Beitrag: 13.07.07, 08:56 -
Problem mit Image List
Von codeman im Forum .NET Windows FormsAntworten: 0Letzter Beitrag: 25.12.05, 20:26 -
list-style-image
Von son gohan im Forum CSSAntworten: 3Letzter Beitrag: 23.07.05, 15:11 -
list-style-image IE
Von the real intruder im Forum CSSAntworten: 3Letzter Beitrag: 13.05.05, 10:20





Zitieren
Login






[PHP][Snippet] Array zu XML konvertieren