age(),0);
# $age = 21; // Debug Code
echo '$age1: '.$age.'
'; // Debug Code
$age -= (($age>14)?(($age>21)?2:1):0);
# ($age>14)?($age-=1):$age;
if ($age>28) { $age=28; }
echo '$age2: '.$age.'
'; // Debug Code
?>
'; // Debug Code
# maketransparent("http://tycho.usno.navy.mil/cgi-bin/phase.gif","jpmoon.png",50,50);
maketransparent("http://umbra.nascom.nasa.gov/images/latest_solisHe_thumbnail.gif","jpsun.png",50,50);
function maketransparent($oldfile,$newfile,$width,$height)
// Turn black background transparent and re-size
{
$info = getimagesize($oldfile);
$im = imagecreatefromgif($oldfile);
$img = imagecreatetruecolor($width,$height);
$trans = imagecolorallocate($img, 0x00, 0x00, 0x00);
imagecolortransparent($img,$trans);
imagecopyresized($img,$im,0,0,0,0,$width,$height,$info[0],$info[1]);
imagetruecolortopalette($img, true, 256);
imageinterlace($img);
imagepng($img,$newfile);
imagedestroy($img);
}
function saveImage($oldfile,$newfile,$width,$height)
// Save Image and re-size
{
$info = getimagesize($oldfile);
$im = imagecreatefromgif($oldfile);
$img = imagecreatetruecolor($width,$height);
imagecopyresized($img,$im,0,0,0,0,$width,$height,$info[0],$info[1]);
imageinterlace($im);
imagepng($im,$newfile);
imagedestroy($img);
}
?>