Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Problem z szeregowaniem według nazw
Forum PHP.pl > Forum > Przedszkole
kamilmm
Witam
mam taki skrypt do galerii zdjęć:

  1. <?
  2. header("Cache-Control: no-store, no-cache, must-revalidate");
  3. header("Pragma: no-cache");
  4.  
  5. require('./sp_conf.php');
  6.  
  7. include $gheader;
  8. $header_html = str_replace('{NAME}', $gallery_name, $header_html);
  9. $header_html = str_replace('{DOWNLINK}', 'http://www.adresstrony.pl/', $header_html);
  10. $header_html = str_replace('{AUTHORLINK}', 'http://www.adresstrony.pl/', $header_html);
  11. $header_html = str_replace('{BACKLINK}', $back_link, $header_html);
  12. $header_html = str_replace('{CLOSELINK}', $close_link, $header_html);
  13. $header_html = str_replace('{COPYRIGHT}', $copyright, $header_html);
  14. $header_html = str_replace('{HOMELINK}', $home_link, $header_html);
  15. echo $header_html;
  16.  
  17. $dp = @opendir($directory);
  18. if ( !$dp )
  19. {
  20. echo "Opening directory " . $directory . " <b>failed</b>. Incorrect path?";
  21. echo "n<br />I cannot go on any longer. I'm sorry. I tried.n<br />";
  22. }
  23. else
  24. {
  25. $extensions = array(
  26. 'jpg',
  27. 'jpeg',
  28. 'gif',
  29. 'png',
  30. 'bmp',
  31. 'tiff',
  32. 'tif',
  33. 'psd'
  34. );
  35.  
  36. require($glayout);
  37.  
  38. $i=1;
  39. $x=1;
  40.  
  41. while ( $filename = readdir($dp) )
  42. {
  43. $theline = $line;
  44. $fileparts = explode(".", strrev($filename), 2);
  45. $name = strrev($fileparts[1]);
  46. $ext = strrev($fileparts[0]);
  47. unset($fileparts);
  48. if ( in_array(strtolower($ext), $extensions) )
  49. {
  50. if ( $x == 1 )
  51. {
  52. echo $line_start;
  53. }
  54. $image_url = './sp_images.php?size=' . $max_size . '&filename=' . $filename . '&action=thumb';
  55. $theline = str_replace('{IMAGE_URL}', $image_url, $theline);
  56. if ( $spoofing )
  57. {
  58. $link = './sp_images.php?filename=' . $filename . '&action=spoof';
  59. }
  60. else
  61. {
  62. $link = $images_uri . $filename;
  63. }
  64. $num = $x;
  65.  
  66. $theline = str_replace('{ROWPOS}', $num, $theline);
  67. $theline = str_replace('{NUMBER}', $i, $theline);
  68. $theline = str_replace('{LINK}', $link, $theline);
  69. $name = str_replace("%20", " ", $name);
  70. $name = str_replace("_", " ", $name);
  71. $theline = str_replace('{NAME}', $name, $theline);
  72. $theline = str_replace('{FILESIZE}', (int)(filesize($directory . $filename)/1024), $theline);
  73. $theline = str_replace('{FILENAME}', $filename, $theline);
  74. $theline = str_replace('{DOWNLINK}', 'http://www.adresstrony.pl/', $theline);
  75. $theline = str_replace('{AUTHORLINK}', 'http://www.adresstrony.pl/', $theline);
  76. echo $theline;
  77.  
  78. if ( $x == (int)$per_row )
  79. {
  80. echo $line_end;
  81. $x=1;
  82. }
  83. else
  84. {
  85. $x++;
  86. }
  87. $i++;
  88. }
  89. }
  90. $terminate_leftover = str_replace('{DOWNLINK}', 'http://www.adresstrony.pl/', $terminate_leftover);
  91. $terminate_leftover = str_replace('{AUTHORLINK}', 'http://www.adresstrony.pl/', $terminate_leftover);
  92. $terminate_leftover = str_replace('{NUMLEFT}', (($per_row-$x)+1), $terminate_leftover);
  93. echo $terminate_leftover;
  94. }
  95.  
  96. include $gfooter;
  97. $footer_html = str_replace('{NAME}', $gallery_name, $footer_html);
  98. $footer_html = str_replace('{DOWNLINK}', 'http://www.adresstrony.pl/', $footer_html);
  99. $footer_html = str_replace('{AUTHORLINK}', 'http://www.adresstrony.pl/', $footer_html);
  100. $footer_html = str_replace('{BACKLINK}', $back_link, $footer_html);
  101. $footer_html = str_replace('{CLOSELINK}', $close_link, $footer_html);
  102. $footer_html = str_replace('{COPYRIGHT}', $copyright, $footer_html);
  103. $footer_html = str_replace('{HOMELINK}', $home_link, $footer_html);
  104. echo $footer_html;
  105.  
  106. ?>


co zrobić zeby zdjęcia ustawiały mi się według nazw questionmark.gif?

001.jpg
002.jpg
itd a nie losowo,
prosze o pomoc rolleyes.gif
dr_bonzo
Wczytaj nazwy plikow do tablicy A POTEM posortuj i na koniec wyswietl.
A nie tak jak teraz po odczytaniu kolejnego pliku wyswietlasz od razu.
kamilmm
a mogłbyś mi pomoc to zrobić questionmark.gif
kombinowałem, ale nie wychodzi sad.gif

proszę o pomoc, ważne
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.