Beim folgenden Skript muss lediglich: $lat & $lon auf die eigene Position geändert werden.
MST
$breite = 48; // Pixel
$hoehe = 48; // Pixel
$zeiger = 48; // Pixel
$lat = 54; // Breite - GEO
$lon = 10; // Länge - GEO
$tage = 365;
$sunset = date_sunset(mktime(0, 0, 0, 12, 21, 2008), SUNFUNCS_RET_TIMESTAMP, $lat, $lon, 90, 2);
$sunrise = date_sunrise(mktime(0, 0, 0, 12, 21, 2008), SUNFUNCS_RET_TIMESTAMP, $lat, $lon, 90, 2);
$min = ($sunset - $sunrise)/3600;
$sunset = date_sunset(mktime(0, 0, 0, 6, 21, 2008), SUNFUNCS_RET_TIMESTAMP, $lat, $lon, 90, 2);
$sunrise = date_sunrise(mktime(0, 0, 0, 6, 21, 2008), SUNFUNCS_RET_TIMESTAMP, $lat, $lon, 90, 2);
$max = ($sunset - $sunrise)/3600;
$sunset = date_sunset(time(), SUNFUNCS_RET_TIMESTAMP, $lat, 10, 90, 2);
$sunrise = date_sunrise(time(), SUNFUNCS_RET_TIMESTAMP, $lat, 10, 90, 2);
$dauer = ($sunset - $sunrise)/3600;
$month = date("m") + 0;
$lfd_tag = date("z") + 9;
$im=imagecreate($breite,$hoehe);
$white=imagecolorallocate($im,255,255,255);
imagecolortransparent($im,$white); // Making Image Transparent
$lightblue=imagecolorallocate($im,20,93,233);
$black=imagecolorallocate($im,0,0,0);
$white=imagecolorallocate($im,255,255,255);
$blue=imagecolorallocate($im,128,55,225);
$grau_gruen=imagecolorallocate($im,0,128,128);
$yellow=imagecolorallocate($im,255,255,0);
$rgb_red=imagecolorallocate($im,255,0,0);
$rgb_gruen=imagecolorallocate($im,0,255,0);
$rgb_blau=imagecolorallocate($im,0,0,255);
$fakt = $tage / ($max-$min);
$gr_f = $tage / $breite;
for($x=0; $x< $tage; $x = $x + 0.1) {
$x2 = $x / $gr_f;
$sunset = date_sunset(1229814000 + ($x * 3600 * 24), SUNFUNCS_RET_TIMESTAMP, $lat, $lon, 90, 2);
$sunrise = date_sunrise(1229814000 +($x * 3600 * 24), SUNFUNCS_RET_TIMESTAMP, $lat, $lon, 90, 2);
$y2 = ($sunset - $sunrise)/3600;
$y2 = $y2 - $min;
$y2 = $y2 * $fakt / $gr_f;
$y2 = ($y2*-1)+$hoehe;
imageline ($im, $breite/2, $hoehe, $x2, $y2+($hoehe-$zeiger), $lightblue);
}
ImageString ($im, 2, 8, 36, number_format($dauer, 1, ".", "." ) . " h", $yellow);
$x2 = $lfd_tag / $gr_f;
$y2 = $dauer;
$y2 = $y2 - $min;
$y2 = $y2 * $fakt/ $gr_f;
$y2 = ($y2*-1)+$hoehe;
imagefilledarc($im, $x2, $y2, 6, 6, 0, 360 , $rgb_red, IMG_ARC_PIE);
// oder
// imageline ($im, $breite/2, $hoehe, $x2, $y2+($hoehe-$zeiger), $rgb_red);
imagepng($im, IPS_GetKernelDir()."media\ rend_sonnenschein.png");