Jump to content


Photo

Displaying Images


  • Please log in to reply
1 reply to this topic

#1 MoFish

MoFish
  • Members
  • PipPipPip
  • Advanced Member
  • 210 posts

Posted 20 April 2006 - 01:26 PM

hey.

im currently using the following code to display images in my gallery. It displays 3 per row in firefox, however when i go to explorer, it displays one image per row, which is not the effect im after. means endless scrolling. :)

is there a solution to make this work in explorer too?


while ($myrowimage = mysql_fetch_array($imageresult) ) {     
    
    $image = $myrowimage["image"];
    $name = $myrowimage["author"];
                
    echo '<div class="gallery">';                      
        echo "<a class='pic' href='gallery/$image' target='_blank'> <img src='gallery/tn_$image' /><br/>Uploaded By <b>$name</b> </a>";
        echo '</div>';

}

.pic    {     height:150px;
            width:180px;
        float:left;
        padding:5px;
        margin:5px;
        text-align:center;
        font-family: Verdana, Arial, Helvetica, sans-serif;
        font-size: x-small;
}


#2 wisewood

wisewood
  • Members
  • PipPipPip
  • Advanced Member
  • 226 posts
  • LocationRotherham, England

Posted 20 April 2006 - 01:35 PM

This is what i use... change the ($x%3) to the number of results you want per row.

<?php
// YOUR MYSQL QUERY GOES HERE
$numberall = mysql_numrows($result);

if ($numberall==0) {
    echo "No Results Found !";
}
else if ($numberall>0) {
$x=0;
?>

<table class="content" align="center">
<?
while ($x<$numberall)
      {
           if (($x%3)==0) { $row="</tr><tr><td class=report>"; } else { $row="<td>"; }
            $variable=mysql_result($resultall,$x,"my_table_row");

?>

<? echo $row ?>

<td class="report">

<?=$variable?>

</td>

<?
        $x++;
    } // end while
} // end if numberall > 0
?>

wisewood: proven fact, I am both wise, and wooden.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users