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
https://forums.phpfreaks.com/topic/7945-displaying-images/
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
https://forums.phpfreaks.com/topic/7945-displaying-images/#findComment-28956
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.