【问题标题】:thumbnail order in a carrousel playlist轮播播放列表中的缩略图顺序
【发布时间】:2011-12-10 23:25:20
【问题描述】:

我们为视频播放器设置了带有缩略图的轮播播放列表。 系统查看缩略图文件夹并显示轮播中的所有缩略图。每个拇指可以启动的是自己的视频。 一切都很好,除了我无法订购我的缩略图。我将它们命名为: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 标签放在代码中

【问题讨论】:

    标签: php javascript video thumbnails playlist


    【解决方案1】:
    <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-08-17
    • 1970-01-01
    • 2012-06-17
    • 2020-09-25
    • 1970-01-01
    • 1970-01-01
    • 2012-05-24
    • 2013-10-19
    • 2013-08-27
    相关资源
    最近更新 更多