Jump to content

projecttool8

New Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by projecttool8

  1. You could actually just use CSS styling to achieve this. Give the images display: inline-block; and they will tile horizontally until they get to the edge of the parent container, then drop down and continue on.

     

    Example: http://jsfiddle.net/fzbe4jpm/

     

    To achieve it with a for loop, you can use the modulus operator to decide when to insert a line break.

    $i = 1;
    foreach ($images as $image) {
    	if ($i % 4 === 0) { 
    		echo '<br />';
    	}
    
    	echo '<img src="' . $image . '" />';
    
    	$i++;	
    }
    Something like that.

     

    Thank you for the tip. A for loop did actually work... This prints the result/format that was required:

     

    <html>

    <body>

    <table border="1"><tr>

    <?php

    for ($number = 1; $number <= 8; $number++) {

    if ($number % 4 === 1){

    echo '</tr>';

    }

    echo '<td>'.$number.'</td>';

    }

    ?>  

    </tr></table>

    </body>

    </html>

     

  2. So, I currently have a script (in beta mode, only works when the sun shines), that can upload an image and store directly in a mysql database (using the BLOB data type); the script is also able to retrieve the BLOB data and display them vertically on the page; I actually need to dsiplay them horizontally across the page instead. So currently the retrieved images are printed in this format:

    1

    2

    3

    4

    5

    6

    7

    8

     

    and I need it to print this way:

    1 2 3 4

    5 6 7 8

     

    sounds like a for loop somewhere... any takers on how to implement the feature?

     

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