forked from Godastera/gesior-aac
-
Notifications
You must be signed in to change notification settings - Fork 0
/
headline.php
50 lines (43 loc) · 1.66 KB
/
headline.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
42
43
44
45
46
47
48
49
50
<?php
//$text = $_GET['text'];
/**/
require_once "custom_scripts/gd-text/Box.php";
require_once "custom_scripts/gd-text/Color.php";
require_once "custom_scripts/gd-text/HorizontalAlignment.php";
require_once "custom_scripts/gd-text/TextWrapping.php";
require_once "custom_scripts/gd-text/VerticalAlignment.php";
require_once "custom_scripts/gd-text/Struct/Point.php";
require_once "custom_scripts/gd-text/Struct/Rectangle.php";
use GDText\Box;
use GDText\Color;
$text = $_REQUEST['text'];
$im = imagecreatetruecolor(300, 35);
$backgroundColor = imagecolorallocate($im, 0, 0, 0);
imagefill($im, 0, 0, imagecolortransparent($im, null));
$box = new Box($im);
$box->setFontFace(__DIR__ . "/images/martel.ttf"); // http://www.dafont.com/elevant-by-pelash.font
$box->setFontSize(25);
$box->setFontColor(new Color(240, 209, 164));
//$box->setFontColor(new Color(0, 0, 0));
$box->setBox(0, -5, 500, 35);
$box->setTextAlign('left', 'top');
$box->setStrokeColor(new Color(2, 2, 2)); // Set stroke color
//$box->setStrokeColor(new Color(255, 255, 255)); // Set stroke color
$box->setStrokeSize(1); // Stroke size in pixels
$box->draw($text); // Text to draw
/**/
header("Content-type: image/png;");
imagepng($im, null, 9, PNG_ALL_FILTERS);
die();
/** Just for save the original code
if (!file_exists('images/head/' . $text . '.png')) {
$font = "images/martel.ttf";
$image = imagecreatefrompng('images/head/headline.png');
imagettftext($image, 18, 0, 4, 20, imagecolorallocate($image, 240, 209, 164), $font, $text);
imagepng($image, 'images/head/' . $text . '.png');
}
$img = 'images/head/' . $text . '.png';
$pic = imagecreatefrompng($img);
header('Content-type: image/png');
imagepng($pic);
* */