1: <?php
2: $imgdir="./pictures/";
3:
4: $latestFile="";
5: $latestCTime=0;
6:
7: if ($handle = opendir($imgdir))
8: {
9: while (false !== ($file = readdir($handle)))
10: {
11: if ($file != "." && $file != "..")
12: {
13: $fp = fopen($imgdir.$file, "r");
14: // sammle Statistiken
15: $fstat = fstat($fp);
16: fclose($fp);
17:
18: if($fstat["ctime"] >= $latestCTime)
19: {
20: //Get latest file name
21: $latestFile=$file;
22: $latestCTime=$fstat["ctime"];
23: }
24: }
25: }
26: closedir($handle);
27: }
28:
29: header('Content-type: image/png');
30:
31: // Open watermark
32: $imgzeichen = imagecreatefrompng('wasserzeichen-1.png');
33: // Open Image
34: $imgsrc = imagecreatefromjpeg($imgdir.$latestFile);
35:
36: // Image information
37: $width = imagesx($imgsrc);
38: $height = imagesy($imgsrc);
39:
40: // Create empty image
41: $img = imagecreatetruecolor($width, $height);
42:
43: // Paste Webcam image as background
44: imagecopy($img, $imgsrc, 0, 0, 0, 0, $width, $height);
45:
46: // paste watermark in the right lower corner
47: imagecopy($img, $imgzeichen, $width-241, $height-50, 0, 0, 241, 50);
48:
49: //Create colors for text
50: $black = ImageColorAllocate ($img, 0, 0, 0);
51: $white = ImageColorAllocate ($img, 255, 255, 255);
52: $imgText="Willkommen - Welcome - BERGLAND APPARTEMENTS*** in Lech am Arlberg: ".date("d.m.Y H:i:s",$latestCTime);
53: //Line one
54: ImageTTFText($img, 10, 0, 3, 13, $white, "./font/AnticSlab-Regular.ttf",$imgText);
55: //Line two if necessary. Replace the fifth parameter with a multiple of 13
56: //ImageTTFText($img, 10, 0, 3, 26, $white, "./font/AnticSlab-Regular.ttf","");
57: // Show image directly
58: imagepng($img);
59:
60: // Free memory
61: imagedestroy($img);
62: ?>
Letzter Senf