-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
59 lines (49 loc) · 1.42 KB
/
index.php
File metadata and controls
59 lines (49 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
/**
* Overlay sample script.
*
* @author Ch'Ih-Yu <chi-yu@web.de>
* @copyright 2022 Random-Host.tv
* @license https://opensource.org/licenses/BSD-3-Clause BSD License (3 Clause)
*
* @see https://github.random-host.tv
*/
declare(strict_types=1);
use randomhost\Image\Webcam\Overlay;
require_once realpath(__DIR__.'/../../vendor').'/autoload.php';
$dataDirPath = realpath(__DIR__.'/../data');
// get Overlay instance
$overlay = new Overlay();
// set basic webcam image properties
$overlay
->setWebcamImagePath($dataDirPath.'/webcam.jpg')
->setOutputImageScale(80)
;
// set watermark properties
$overlay
->setWatermarkEnabled(true)
->setWatermarkImagePath($dataDirPath.'/watermark.png')
->setWatermarkImagePosition(Overlay::IMAGE_TOP_RIGHT)
;
// set downtime properties
$overlay
->setDowntimeEnabled(true)
->setDowntimeImagePath($dataDirPath.'/offline.png')
->setDowntimeImagePosition(Overlay::IMG_CENTER)
->setDowntimeStart('02:00:00')
->setDowntimeEnd('08:00:00')
;
// set informational text properties
$overlay
->setInfoTextEnabled(true)
->setInfoTextContent(' © example.com')
->setInfoTextFont($dataDirPath.'/vera.ttf')
->setInfoTextFontSize(9)
->setInfoTextPositionX(3)
->setInfoTextPositionY(188)
->setInfoTextColor([0xFF, 0xFF, 0xFF])
->setInfoTextBorderEnabled(true)
->setInfoTextBorderColor([50, 50, 50])
;
// render image
$overlay->render();