include("connect_db.php");
include("header.php");
$query = "select title,content,pic1_name,pic2_name,pic3_name,
pic1_describe,pic2_describe,pic3_describe,pic1_order,pic2_order,pic3_order
from kung_record
where record_no='$record_no'";
$result = mysql_query($query);
list($title,$content,$pic1_name,$pic2_name,$pic3_name,
$pic1_describe,$pic2_describe,$pic3_describe,
$pic1_order,$pic2_order,$pic3_order) = mysql_fetch_row($result);
$pic_array[$pic1_order]['name'] = $pic1_name;
$pic_array[$pic1_order]['desc'] = $pic1_describe;
$pic_array[$pic2_order]['name'] = $pic2_name;
$pic_array[$pic2_order]['desc'] = $pic2_describe;
$pic_array[$pic3_order]['name'] = $pic3_name;
$pic_array[$pic3_order]['desc'] = $pic3_describe;
//evaluate image height
$img_height = 140;
if($pic1_name != "") $img_height += 135;
if($pic2_name != "") $img_height += 135;
if($pic3_name != "") $img_height += 135;
if($pic1_describe != "") $img_height += 10;
if($pic2_describe != "") $img_height += 10;
if($pic3_describe != "") $img_height += 10;
//evaluate text height
//assume each line contain 50 characts, 3 sections, and height of (line + text) is 30 pixels
$text_height = (ceil(strlen($content) / 50)+4)*30;
if($text_height > $img_height)
$img_height = $text_height;
?>
include("tailer.php"); ?>