-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimage.php
104 lines (85 loc) · 2.58 KB
/
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
/*******************************************************************\
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ #
# @ ArBB V 1.0.0 Beta 1 @ #
# @ All Copyrights are saved Arabian bulletin board team @ #
# @ Copyright © 2009 ArBB Team @ #
# @ ArBB Is Free Bulletin Board and not for sale @ #
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ #
\*******************************************************************/
#
# image creator File started
#
/*
File name -> image.php
File Version -> 1.0.0 Beta 1
File Programmer -> Thaer
File type -> file
*/
$templatelist='';
$phrasearray=array();
require('global.php');
require('./includes/class_gd.php');
$GD = new arbb_gd;
if($arbb->input['imagehash'] == 'test')
{
$image_string = 'ArBB';
}
else
{
$im = $DB->query_now("select * from "._PREFIX_."regimage where imagehash='".$DB->escape_string($arbb->input['imagehash'])."'");
$image_string = $im['imagestring'];
$DB->query("delete from "._PREFIX_."regimage where dateline<'".(TIMENOW-360)."'");
}
$fonts = array();
if(function_exists('imagefttext'))
{
$fdir = @opendir('./includes/regimage_fonts');
if($fdir)
{
while($file = readdir($fdir))
{
if(is_file('./includes/regimage_fonts/'.$file) && get_extension($file) == 'ttf')
{
$fonts[] = './includes/regimage_fonts/'.$file;
}
}
}
}
if(count($fonts) > 0)
{
$use_ttf = 1;
}
else
{
$use_ttf = 0;
}
// Check for GD >= 2, create base image
if($GD->gd_version() >= 2)
{
$image = imagecreatetruecolor($GD->img_width, $GD->img_height);
}
else
{
$image = imagecreate($GD->img_width, $GD->img_height);
}
// No GD support, die.
if(!$image)
{
die('No GD support.');
}
$bg_color = imagecolorallocate($image, 255, 255, 255);
imagefill($image, 0, 0, $bg_color);
$draws = array('circles','squares','lines');
$GD->draw($image,'dots');
$GD->draw($image,$draws[array_rand($draws)]);
// Write the image string to the image
$GD->draw($image,$image_string);
// Draw a nice border around the image
$border_color = imagecolorallocate($image, 0, 0, 0);
imagerectangle($image, 0, 0, $GD->img_width-1, $GD->img_height-1, $border_color);
// Output the image
header('Content-type: image/png');
imagepng($image);
imagedestroy($image);
?>