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 标签放在代码中

4

1 回答 1

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>';
   }
 }
于 2011-10-19T14:17:38.917 回答