-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathexample.php
43 lines (35 loc) · 1.17 KB
/
example.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
<?php
require_once('persian_log2vis.php');
if(!isset($_GET['submit'])){
echo '<html dir="rtl">
<head><title>Persian_log2vis Example</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body>
<form method="get">
<textarea name="text">ایــن متن برای تست میباشد:
بالا
فَعّال
الف abc ب
۲۰ و 20 - ۳۰ و 30
</textarea>
<input type="submit" name="submit" value="submit">
</body></html>';
}else{
$text = $_GET['text'];
persian_log2vis($text);
// Create the image
$im = imagecreatetruecolor(400, 200);
// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
// Replace path by your own font path
$font = './DejaVuSans.ttf';
// Add the text
@imagettftext($im, 20, 0, 10, 30, $white, $font, $text);
// Set the content-type
header("Content-type: image/png");
// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
}
?>