-
Notifications
You must be signed in to change notification settings - Fork 0
/
image.php
41 lines (32 loc) · 870 Bytes
/
image.php
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
<?php
require __DIR__ . '/vendor/autoload.php';
use App\Text;
$imageName = $_GET['image'] ?? 'larajobs1';
$startY = $_GET['start'] ?? 250;
$step = $_GET['step'] ?? 50;
$debug = $_GET['debug'] ?? false;
$size = (int)$_GET['size'];
$vacancy = $_GET['vacancy'] ?? '';
$salary = $_GET['salary'] ?? '';
$town = $_GET['town'] ?? '';
$exp = $_GET['exp'] ?? '';
/** @var Text\BaseAbstract[] $texts */
$texts = [
new Text\Vacancy($vacancy),
new Text\Salary($salary),
new Text\Town($town),
new Text\Experience($exp)
];
if (!$debug) {
header('Content-type: image/jpeg');
}
$jpg_image = imagecreatefromjpeg(App\DataHelper::getImage($imageName));
foreach ($texts as $item) {
$item->setImage($jpg_image);
$item->setY($startY);
$item->setSize($size);
$startY += $step;
$item->write();
}
imagejpeg($jpg_image);
imagedestroy($jpg_image);