2011-10-19 41 views
0

我們爲視頻播放器設置了帶縮略圖的卡魯塞爾播放列表。 系統會查看縮略圖文件夾並在卡魯塞爾中顯示所有的拇指。每個拇指可以發射的是自己的視頻。 除了事實我不能訂購我的縮略圖,一切都很好。我將它們命名爲:00mythumb.jpg,01mythumb.jpg等等,我正在尋找一種方法在卡魯塞爾中訂購它們。在卡羅素播放列表中縮略圖訂購

我的代碼如下:?

<ul id="mycarousel" class="jcarousel-skin-tango"> 
<?php 
$i = 0; 
$dir = opendir('./gallery/pics'); 
while ($file = @readdir($dir)) { 
//Récupération de l'extension du fichier 
$extension=substr(strrchr($file,'.'),1); 
if($file != '.' && $file != '..'){ 
    $i++; 
    //Suppression de l'extension du fichier 
    $pos = strpos($file, '.'); 
    $file = substr($file, 0, $pos); 
    //Inscription de la ligne en HTML 
    echo '<li><a onclick="jwplayer().load(\'./gallery/video/'. $file. '.mp4\')"><imag src="./gallery/pics/'. $file. '.jpg" width="164" height="95" alt=""/></a></li>'; 
} 

} >

任何幫助,將不勝感激。 非常感謝你,併爲我的壞英語道歉。 PS:我換成IMAG IMG因爲堆棧溢出不要讓我把img標籤的代碼

回答

3
<ul id="mycarousel" class="jcarousel-skin-tango"> 
<?php 
$i = 0; 
$dir = opendir('./gallery/pics'); 
$files = array(); 
while ($file = @readdir($dir)) { 
     $files[] = $file; 
} 
sort($files); 
foreach($files as $file) { 
    //Récupération de l'extension du fichier 
    $extension=substr(strrchr($file,'.'),1); 
    if($file != '.' && $file != '..'){ 
     //Suppression de l'extension du fichier 
     $pos = strpos($file, '.'); 
     $file = substr($file, 0, $pos); 
     //Inscription de la ligne en HTML 
     echo '<li><a onclick="jwplayer().load(\'./gallery/video/'. $file. '.mp4\')"><imag src="./gallery/pics/'. $file. '.jpg" width="164" height="95" alt=""/></a></li>'; 
    } 
} 
+0

因爲我想我會的名字我裏面的圖片?或者我應該把它們放在字母數字順序? – numerosept

+0

好吧我剛剛測試,它的工作完美...感謝您的幫助:-) – numerosept