PDA

View Full Version : variable image sizes in a table



vielip
10-25-2006, 09:03 AM
hello,

i want to make a script that takes images of various sizes out of a folder
and puts them in a table of with a fixed width.
whenever a line is filled with images and the next image that should be inserted does not fit anymore it should start with a new line of images in order to leave the table width set.

what i got but does not work because the script forces the table to expand:

/* images */

function load_images($who)
{
include('inc/dbconnect.php');
$tmprslt = '';
$connection = mysql_connect($dbhost,$dbuser,$dbpwd);
if($connection)
{
mysql_select_db($dbname);
$sql = "SELECT * FROM projects WHERE who = '$who'";
$result = mysql_query($sql);
if($result)
{
$tmprslt .= '<table cellpadding="0" cellspacing="10" border="0"><tr>';
while($projects = mysql_fetch_object($result))
{
$tmprslt .= '<td><img src="http://www.fageta.ch/web2/project-main-img/'.$projects->img.'"></td>';
}
$tmprslt .= '</tr></table>';
}
mysql_close();
}
return $tmprslt;
}



i know that i should do something with get image width but i do not know how it should work, if anyone could point me to similar cases or help in another way i would appreciate it.

thanks a lot
vielip