Jump to content

Displaying Images


MoFish

Recommended Posts

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?


[code]
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>';

}
[/code]

[code]
.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;
}
[/code]
Link to comment
Share on other sites

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

[code]
<?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
?>
[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.