html - PHP selecting images with specific width and building a grid -


i'm having trouble building dynamic grid php this: grid

i have array containing images in various sizes, either 900 or 1800 in width.

looks this:

$images = array('img_1_900.jpg', 'img_2_900.jpg', 'img_3_1800.jpg', 'and on'); 

is there smart way this? i'm kind of new php-thing, hints nice. here's got far:

 $img_count = count($images);  $i = 1;  while($i <= $img_count){     list($width) = getimagesize($images[$i]);     if($width = 1800){      }     $i++;  } 

i know nothing, don't know go here. hope kind soul me little along. can't float them, because need stay on line after resize, kind of table/table-div has it. guess.

thanks in advance!

if image array allway build in same way... , not getting sorted...

$i = 0; $html = "<table cellpadding='0' cellspacing='10' border=1>" foreach($image $img){     if($i == 0)         $html .= "<tr>";     if($i < 2){         $html .= "<td><img src='{$img}' /></td>";         $i++;     }     if($i == 2){       $html .= "</tr><tr>";       $html .= "<td colspan=2><img src='{$img}' /></td>";       $i = 0;     } } echo $html; 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -