[Solved] Listing photos with php [closed]


When looping to display the images you need to break every 10 photos like so:

$photosPerLine = 10;
for ( var $i = 0; $i < $totalNumPhotos; $i++ )
{
    drawPhoto();  // This does the actual drawing - perhaps echo a <IMG> or whatever

    // Now we check if we've reached 10 in a row, we do this by dividing the
    // photo counter by 10 and checking for a reminder, only numbers in leaps
    // of 10 will divide without a reminder.  If we don't have a reminder it means
    // we're at 10, 20, 30 ... so we break the line

    if ( ( $i + 1 ) % $photosPerLine == 0 )
    {
        echo( '<br/>' );  // Or create a new row in a table or whatever
    }
}

Or just place the images in a container (<div> for example) with a specified width to hold exactly 10 images and let the browser break lines to fit the content.

solved Listing photos with php [closed]