使用php幻灯片图像

时间:2012-10-03 10:11:07

标签: php html css

我试图仅使用php幻灯片图片。     我尝试使用代码从数组中滑动图像。     但它只在新窗口中显示一个全尺寸图像。     代码是:     我应该在标题中写什么来看下一张图片的幻灯片。      和       $图像[$ I] =“上传/".$ IMG;     将图像路径“uplods”存储到$ images数组中是否正确。

i have refer this site for code:
http://www.sitepoint.com/picture-showcase-php-html/







<?php
          $sql="SELECT * FROM gallary WHERE aid='$aid'";
          $res=mysql_query($sql);
          $count=mysql_num_rows($res);                  


                    for($i=1;$i<$count;$i++)
                      {
                            $row=mysql_fetch_assoc($res);
                            $img=stripslashes($row['image']);                 
                            $images[$i]="uploads/".$img;
                      }//end of for
                         //print_r($images);
                         $total=count($images); 
                        $secondsFixed=10; // seconds to keep list the same <br>  
                        $seedValue=(int)(time()/$secondsFixed); 
                        srand($seedValue); 

                        for ($i=0;$i<$total;++$i) // shuffle list 'randomly' <br>  
                        { 



                                $r=rand(0,$total-1); 
                                $temp =$images[$i]; 
                                $images[$i]=$images[$r]; 
                                $images[$r]=$temp; 
                        }

                        $index=(int)($_GET['i']); // image index passed in <br>  
                        $i=$index%$total; // make sure index always in bounds <br>  
                        $file=$images[$i]; 
                        header("Location:"); // and pass file reference back <br>  
                        ?>  
                     </div>

            </div><!--End of right Container -->   

0 个答案:

没有答案