PHP picture gallery

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kairike
Forum Newbie
Posts: 1
Joined: Fri Oct 24, 2008 3:46 am

PHP picture gallery

Post 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 :!:
sirish
Forum Newbie
Posts: 8
Joined: Tue Sep 09, 2008 11:45 pm

Re: PHP picture gallery

Post 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>
Post Reply