$ctr = 0;
while ($row = mysql_fetch_array($result)) {
$ctr = $ctr+1;
if($row[logo]) {
//--> Ajusta altura ou largura do logo
$max_width = 61;
$max_height = 64;
$source_pic = './images/fotos/'.$row[id].'/'.$row[logo];
list($width,$height)=getimagesize($source_pic);
$x_ratio = $max_width / $width;
$y_ratio = $max_height / $height;
if( ($width <= $max_width) && ($height <= $max_height) ){
$tn_width = $width;
$tn_height = $height;
}elseif (($x_ratio * $height) < $max_height){
$tn_height = ceil($x_ratio * $height);
$tn_width = $max_width;
}else{
$tn_width = ceil($y_ratio * $width);
$tn_height = $max_height;
}
$logo = $source_pic;
} else {
$logo = './images/no-logo.jpg';
$tn_width = "61";
$tn_height = "64";
}
if($ctr==1) {
$ctr3=FALSE;
$ctr6=FALSE;
?>