Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php] jak dodac "filtr" dla nazwy pliku w tym skrypcie, chcialbym dodac do skryptu filtr na podstawie nazwy pliku
gariz
post
Post #1





Grupa: Zarejestrowani
Postów: 22
Pomógł: 0
Dołączył: 7.06.2007

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


mam taki skrypt
  1. <?php
  2. function returnimages($dirname=".") {
  3. $pattern="(.jpg$)|(.png$)|(.jpeg$)|(.gif$)"; //valid image extensions
  4. $files = array();
  5. $curimage=0;
  6. if($handle = opendir($dirname)) {
  7. while(false !== ($file = readdir($handle))){
  8. if(eregi($pattern, $file)){ //if this file is a valid image
  9. //Output it as a JavaScript array element
  10. echo 'galleryarray['.$curimage.']="'.$file .'";';
  11. $curimage++;
  12. }
  13. }
  14.  
  15. closedir($handle);
  16. }
  17. return($files);
  18. }
  19.  
  20. echo 'var galleryarray=new Array();'; //Define array in JavaScript
  21. returnimages() //Output the array elements containing the image file names
  22. ?>


i chcialbym zeby nie byly wczytywane wszystkie pliki graficzne ale tylko takie ktore maja w nazwie min_
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 25.08.2025 - 04:37