Page 1 of 1

PHP picture gallery

Posted: Fri Oct 24, 2008 3:55 am
by kairike
Hello!
Im in trouble makeing a page for my baby. :banghead:
I want a decent php gallery (main page here: http://enos.itcollege.ee/~kjaano/Koduyl ... pildid.php)
(code seen here: http://enos.itcollege.ee/~kjaano/Koduyl ... ildid.phps)
I want this page liquid and I want these pictures in row not under each other separately...
How to do it? What should I change? :roll: Im so confused and tried everything already.
(Oh and the CSS file: http://enos.itcollege.ee/~kjaano/Koduylesanne/stiil.css)
Help :!:

Re: PHP picture gallery

Posted: Mon Oct 27, 2008 12:48 am
by sirish
Why don't u make use of the table to get the images in a single row. You can try the following code. Just copy paste the following code and see how table can be used to fulfil ur requirement.

<?
$failid=array(
'1'=>'images/abc.jpg',
'2'=>'images/abc1.jpg',
'3'=>'images/abc3.jpg',
'4'=>'images/abc4.jpg',
'5'=>'images/abc5.jpg',
'6'=>'images/abc6.jpg'
);
//You can change the CSS as per your need
?>
<table border="1" cellpadding="1" cellspacing="1" >
<tr>
<?
$counter=0;
$columns=3; //No. of pictures u want in a single row
foreach($failid as $i=>$f){
if($counter<$columns){
print "<td>
<a href='kennu.php?id=".$i."'><img src='".$f."'></a>
</td>";
$counter++;
}
else{
print "</tr>
<td><a href='kennu.php?id=".$i."'><img src='".$f."'></a>
</td>";
$counter=1;
}
}
?>
</tr>
</table>