Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP]Problem ze skryptem wyświetlającym pliki graficzne
andrzejlechniak
post 28.10.2010, 12:08:20
Post #1





Grupa: Zarejestrowani
Postów: 242
Pomógł: 0
Dołączył: 7.11.2008

Ostrzeżenie: (0%)
-----


Witam
Mam problem ze skryptem wyświetlającym pliki z katalogu. Chodzi o pliki graficzne. Próbuję przerobić skrypt na taki, który będzie wyświetlać funkcję stronicowania plików na stronie, a przynajmniej tak aby na stronie był stała liczba kolumn i wierszy, ale po licznych próbach wymiękam, znaczy się póki co... nic z tego. Proszę pomóżcie. Podaję próby mojego kodu:

  1. $wierszy = 5;
  2. $kolumn = 5;
  3. $x = 0;
  4. $na_stronie = $wierszy * $kolumn;
  5. $razem = count($path);
  6. $stron = floor($razem/$na_stronie);
  7. $stron += $razem % $na_stronie ? 1:0;
  8. $pokaz_strone=$_GET['path'];
  9.  
  10. if(isset($pokaz_strone)) $pokaz_strone = 1;
  11. $start = ($pokaz_strone - 1) * $na_stronie;
  12. $stop = ($pokaz_strone == $stron) ? $razem % $na_stronie: $na_stronie; $stop+=$start;
  13. for ($x = $start; $x<$stop; $x++)
  14. {
  15. if(!($x % $kolumn));
  16.  
  17. }
  18.  
  19. $path = $_GET['path'];
  20. if(!isset($path))
  21. {
  22. $path = "katalog/";
  23. }
  24. if ($handle = opendir($path))
  25. {
  26. $curDir = substr($path, (strrpos(dirname($path."/."),"/")+1));
  27. print "Aktualny katalog: ".$curDir."<br>************************<br>";
  28. print "Sciezka: ".dirname($path."/.")." <br>************************<br>";
  29. while (false !== ($file = readdir($handle)))
  30. {
  31. if ($file != "." && $file != "..")
  32. {
  33. $fName = $file;
  34. $file = $path.'/'.$file;
  35.  
  36.  
  37. if (is_file($file))
  38. {
  39. if (getimagesize($file))
  40. {
  41. echo "<div style='width: 500px;float:left;'>";
  42. echo " <a href='".$file."' target='_blank'><img src='".$file."' style='width:100px;height:80px;margin-left:2px;'/></a> ";
  43. echo "</div>";
  44. }
  45. else
  46. print "[F] <a href='".$file."'>".$fName."</a> ".filesize($file)."B<br>";
  47. }
  48. if(is_dir($file))
  49. {
  50. print "[D] <a href='index.php?path=$file'>".$fName."</a><br>";
  51. }
  52. }
  53. }
  54. $up = substr($path, 0, (strrpos(dirname($path."/."),"/")));
  55. print "<br />[^] <a href='index.php?path=$up'>Przejdz katalog wyzej</a><br>";
  56. closedir($handle);
  57. }


Pozdr, And

Ten post edytował andrzejlechniak 28.10.2010, 12:15:42
Go to the top of the page
+Quote Post
Cysiaczek
post 28.10.2010, 12:11:18
Post #2





Grupa: Moderatorzy
Postów: 4 465
Pomógł: 137
Dołączył: 26.03.2004
Skąd: Gorzów Wlkp.




Cześć,

1. Nadaj temu wątkowi sensowny tytuł.
2. Opisz problem


--------------------
To think for yourself you must question authority and
learn how to put yourself in a state of vulnerable, open-mindedness;
chaotic, confused, vulnerability, to inform yourself.
Think for yourself. Question authority.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 15.08.2025 - 22:26