Den folgenden Code führe ich jede Sekunde aus.
Code: Alles auswählen
<?
// Pfade festlegen
$Objectname = Uhrzeit_jetzt;
include ("c:\\Programme\\contronics\\homeputer Studio\\php\\bmp.php");
include ("c:\\Programme\\contronics\\homeputer Studio\\php\\imagebw.php");
$filejpg = "c:\\Programme\\contronics\\homeputer Studio\\BMP\\".$Objectname.".bmp";
$fontdir = "c:\\WINDOWS\\Fonts\\";
//Variablen festlegen
$SizeX = 170;
$SizeY = 50;
$Font = $fontdir."DS-DIGIB.ttf"; //DS-DIGIB.ttf
//$Font = $fontdir."COUR.TTF"; //DS-DIGIB.ttf
$FontSize_1 = 44;
$FontSize_2 = 28;
$Uhrzeit_Temp = date("H:i:s"); //Uhrzeit hh:mm:ss (24Std.)
//Uhr zerstückeln
$string = $Uhrzeit_Temp;
$StdZ = $string[0];
$StdE = $string[1];
$MinZ = $string[3];
$MinE = $string[4];
$SekZ = $string[6];
$SekE = $string[7];
//Wenn der Wert = 1, dann verschieben
if ($StdZ == 1) $StdZ = " 1";
if ($StdE == 1) $StdE = " 1";
if ($MinZ == 1) $MinZ = " 1";
if ($MinE == 1) $MinE = " 1";
if ($SekZ == 1) $SekZ = " 1";
if ($SekE == 1) $SekE = " 1";
//Farben festlegen
$im = @ImageCreatetruecolor ($SizeX, $SizeY);
$hintergrund = ImageColorAllocate ($im, 255, 255, 255);
$vordergrund = ImageColorAllocate ($im, 0, 0, 0);
// Wegen Fehler in Homeputer-PHP, zunächst Pseudoschrift laden
ImageTTFText ($im, 18, 0, 0, 0, $vordergrund, $fontdir."wingding.ttf", "");
// Den Hintergrund "ausmalen"
imagefill($im, 0, 0, $hintergrund);
//Uhrzeit zusammen basteln
ImageTTFText ($im, $FontSize_1, 0, 0, +$FontSize_1, $vordergrund, $Font, $StdZ);
ImageTTFText ($im, $FontSize_1, 0, +25, +$FontSize_1, $vordergrund, $Font, $StdE);
ImageTTFText ($im, $FontSize_1, 0, +53, +$FontSize_1-2, $vordergrund, $Font, ":");
ImageTTFText ($im, $FontSize_1, 0, +64, +$FontSize_1, $vordergrund, $Font, $MinZ);
ImageTTFText ($im, $FontSize_1, 0, +89, +$FontSize_1, $vordergrund, $Font, $MinE);
ImageTTFText ($im, $FontSize_2, 0, +117, +$FontSize_2+15, $vordergrund, $Font, ":");
ImageTTFText ($im, $FontSize_2, 0, +125, +$FontSize_2+16, $vordergrund, $Font, $SekZ);
ImageTTFText ($im, $FontSize_2, 0, +147, +$FontSize_2+16, $vordergrund, $Font, $SekE);
//Das Bild im Speicher erzeugen und abspeichern
ImageBW($im,"NORMAL");
ImageBmp ($im, $filejpg);
//Das Bild im Speicher zerstören
ImageDestroy ($im);
?>
Durch meine Idee wird jetzt ständig auf der Festplatte geschrieben, was mir nicht gefällt.
Gibt es eine andere Möglichkeit in homestudio eine grafische Uhr zu erzeugen?
Die oberer Uhr ist aus einzelnen Teilen zusammen bebastelt, was mir nicht gefällt. Jedes mal ein großer Aufwand die Uhrzeit in einer Ansicht herein zubasteln
Es geht um die untere Uhr, diese ist als BMP erzeugt. Hier wäre nur ein Objekt nötig, schnell und einfach
MFreye
MfG
MFreye