Próbuje stworzyć prostą galerię. Oto kod:
<?php session_start(); include "logdobazy.php"; $query = "SELECT id, ext FROM zdjecia WHERE album = '".$_REQUEST['j']."'"; //wybór albumu $result = mysql_query($query) or die (mysql_error()); $num = mysql_num_rows($result); $licznik = $_REQUEST['j']; ?> <html> <head> <link rel="stylesheet" href=" style.css " type="text/css" /> <body> <table align='center' border='0' width="1000px" height="100%" rules="none" cellspacing='0' cellpadding='0'> <tr valign='top'> <td width="100px"> <table align='right' border='0' width="100px" height="30px" rules="none" cellspacing='0' cellpadding='0'> <?php if ($_SESSION[level] == 1) { ?> <tr align="center"> </tr> <?php }?> </table> </td> <td rowspan='2'class='lp'> <table align='center' border='0' width="100%" height="100%" rules="none" cellspacing='0' cellpadding='20'> <tr align='center'> </tr> <tr align='center'> <td width="700px" height="800px" valign="top"> <?php if ($_REQUEST['i']==0) //jeżeli jest równe 0 to nie wybrano konkretnego zdjęcia, wyświetlają się wszystkie { while ($row = mysql_fetch_array($result)) //jak zrobić żeby wyświetlać zdjęcia po 12 na stronie? { $id = $row['id']; $ext = $row['ext']; list($width,$height,$type,$attr) = getimagesize('zdjecia/'.$id.$ext); if($width>=$height) { while($width>100) { $height=$height/1.001; $width=$width/1.001; } } else { while($height>100) { $height=$height/1.001; $width=$width/1.001; } } ?> <?php } ?> <br><<1-12 >> <?php } else // pokaz konkretne zdjęcie { $nr = $_REQUEST['i']; $obrazek=$nr .'.jpg'; list($width,$height,$type,$attr) = getimagesize('zdjecia/'.$obrazek); $szer=0.2*$width; $wys=0.2*$height; $query = "SELECT nazwa, opis FROM zdjecia " . "WHERE id = " . $nr . " ; "; $result = mysql_query($query) or die (mysql_error()); $row = mysql_fetch_array($result); $nazwa = $row['nazwa']; $opis = $row['opis']; ?> <img src="/zdjecia/<?php echo $obrazek; ?> " width="<?php echo " $szer"; ?>" height="<?php echo " $wys"; ?>"> <?php } ?> </td> </tr> <tr align='center'> </tr> </table> </td> </tr> </table> </body> </html>
Na początku skaluje zdjęcia zeby byly "troszke mniejsze" (wiem wiem przydalyby sie miniaturki ale to pozniej ). Jak ustawić wszystkie zdjęcia równo, kazde w oddzielnym kwadraciku(obramowaniu)? jakieś pomysły? A druga sprawa to jak wyświetlać po np. 20 zdjęć na stronie a nie wyszystkie naraz?
Ku..wa. Nie tu napisałem. Prosze o przeniesienie tematu do Przeczkola. Z góry dzięki i sorki.