Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Źłe wyświetlanie
Arsanael
post
Post #1





Grupa: Zarejestrowani
Postów: 65
Pomógł: 0
Dołączył: 4.06.2009

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


mam kod ktory powinien (przynajmniej według moich zamierzen) wyswietlac miniaturki z odnosnikiem do normalnego pliku(nie pomniejszonego). Niestety wyswietlając miniaturke obrazu np. x odnośnik jest do innego pliku normalnego dajmy na to y.
Czyli to tak: wyswietla mi obrazek mini_obraz1.png a odnosnik jest do obraz4.png zamiast obraz1.png.

Chyba coś źle wykodziłem, mogłby ktoś luknąc?

Kod
$data_sesion = $_SESSION["user"];
$t=1;
    $i = 0;
        if ($handle = opendir('miniaturki/'.$data_sesion.'/'))
            {        
        while (false !== ($file[$i] = readdir($handle)))
                    {
                            if ($file[$i] != "." && $file[$i] != ".." && $file[$i] != "index.html")
                                        {
                            
                                        $i++;
            }
        
        }
    }



$j = 0;
if ($handle2 = opendir('profil/'.$data_sesion.'/'))
            {    
                while (false !== ($file2[$j] = readdir($handle2)))
                    {
                                if ($file2[$j] != "." && $file2[$j] != ".." && $file2[$j] != "index.html")
                                    {
                        
                                    echo "<a href='profil/$data_sesion/$file2[$j]/'><img                                         src='miniaturki/$data_sesion/$file[$j]'                                                           width=150 height=100></a>";
                        $j++;
                                    if ($t % 3 == 0) echo '<br /><br />';
                                    $t++;

                    }
                }
closedir($handle2);
closedir($handle);
            }

          
        }
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
vonski
post
Post #2





Grupa: Zarejestrowani
Postów: 292
Pomógł: 89
Dołączył: 27.12.2006
Skąd: Warszawa

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


Spróbuj tak:

  1. <?php
  2. if ($handle = opendir('profil/' . $data_sesion) AND $handle2 = opendir('miniaturki/' . $data_sesion))
  3. {
  4.  
  5.    while ((false !== ($file = readdir($handle))) AND (false !== ($file2 = readdir($handle2))))
  6.    {
  7.        if($file != "." AND $file != ".." AND $file != "index.html" AND $file2 != "." AND $file2 != ".." AND $file2 != "index.html")
  8.        {
  9.            echo "<a href=profil/" . $data_sesion . "/" . $file . "><img src=miniaturki/" . $data_sesion . "/" . $file2 . "></img></a>";
  10.                 if($t % 3 == 0)
  11.                        echo "<br /><br />";
  12.                 $t++;
  13.         }
  14.    }
  15.  
  16.    closedir($handle2);
  17.    closedir($handle);
  18. }
  19. ?>


Ten post edytował vonski 19.06.2009, 22:42:02
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: 11.10.2025 - 19:07