From the desk of CCP
Our news page is regularly updated in-house and we welcome any comments.
0)
{
//loop through all the items within the database to output in the top right corner
while ($row_news = it_fetch($res_news))
{
//Change the pictures to see which one is the featured image
if ($row_news['NewsImageFeatured'] == 1)
{
$picMainImage = $row_news['NewsImage1'];
}
elseif ($row_news['NewsImageFeatured'] == 2)
{
$picMainImage = $row_news['NewsImage2'];
}
else
{
$picMainImage = $row_news['NewsImage3'];
}
//Get image size
$picSize = getImageSize("files/news/" . $picMainImage);
//Get the width of picture 1 and 2
$width = $picSize[0];
//Do the calculation only if there is in image in the database
if ($picMainImage != "")
{
//Do the calculation only if the picture is more than 170 in width
if ($width > 100)
{
//Do calculation on height to resize it proportionally to the width
$picWidth = 100;
$percent = ($picSize[0] / $picWidth);
$picHeight = ($picSize[1] / $percent);
}
//Output the picture as it is because it is under 170 in width
else
{
$picWidth = $picSize[0];
$picHeight = $picSize[1];
}
//Output the picture
$picImageName = "
";
}
//Output nothing if there is no image in the database
else
{
$picImageName = "";
}
//output the links
$dtNewsDate = date("d/m/Y",$row_news['NewsDate']);
//output the news description, date and images
echo "
| " . $picImageName ." |
" . $dtNewsDate . "
" . $row_news['NewsHeading'] . " "
. substr(nl2br($row_news['NewsStory']),0,50) . "...
|
";
}
}
?>
include "footer.inc";
?>