require "top_nav.inc"; ?>
require "site_nav.inc"; ?>
|
Marina On The Bay |
|
|
Recent News |
display_blog_titles($con, $limit = 10);
?>
|
|
|
|
News From Bakers Marina on the Bay |
$display_width = 250;
$display_height = 250;
if($_REQUEST["id"] == ''){
$sql = "select * from blog order by id desc limit 1";
}
else{
$sql = "select * from blog where id = ".$_REQUEST["id"];
}
$result = @mysqli_query($con, $sql);
while($row = @mysqli_fetch_array($result, MYSQL_ASSOC)){
$have_image = FALSE;
$ext = $row["ext"];
$width = $row["width"];
$height = $row["height"];
$new_w = $display_width;
$new_h = $display_height;
if(strlen($ext) > 0 && strlen($width) > 0 && strlen($height) > 0){
$have_image = TRUE;
$old_x = $width;
$old_y = $height;
// see if we need to resize...
if($width <= $display_width && $height <= $display_height){
// use as is...
$thumb_w = intval($width);
$thumb_h = intval($height);
}
else{
// look at aspect ratios for resizing...
if ($old_x > $old_y){
$thumb_w=$new_w;
$thumb_h=$old_y*($new_h/$old_x);
}
if ($old_x < $old_y){
$thumb_w=$old_x*($new_w/$old_y);
$thumb_h=$new_h;
}
if ($old_x == $old_y){
$thumb_w=$new_w;
$thumb_h=$new_h;
}
}
$thumb_w = intval($thumb_w);
$thumb_h = intval($thumb_h);
}
$title = stripslashes($row["title"]);
$display_date = stripslashes($row["display_date"]);
$content = stripslashes($row["content"]);
$id = $row["id"];
$author = stripslashes($row["author"]);
$content = str_replace(" ", " ", $content);
print "".$title." ";
print "".$display_date." ";
print "by ".$author." ";
if($have_image){
print "".stripslashes($row["image_caption"])." ";
}
print $content;
}
?>
|
|
|