-
Notifications
You must be signed in to change notification settings - Fork 9
/
imagecreatefromfile7.php
127 lines (107 loc) · 2.63 KB
/
imagecreatefromfile7.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<?php
/**
* @author rest7.com
* @license MIT
* @version 0.1
* @link http://github.com/rest7/api Documentation
*/
function imagecreatefromcin($fileName)
{
return imagecreatefromfile7($fileName);
}
function imagecreatefromsct($fileName)
{
return imagecreatefromfile7($fileName);
}
function imagecreatefrompix($fileName)
{
return imagecreatefromfile7($fileName);
}
function imagecreatefrommtv($fileName)
{
return imagecreatefromfile7($fileName);
}
function imagecreatefromjbg($fileName)
{
return imagecreatefromfile7($fileName);
}
function imagecreatefromdpx($fileName)
{
return imagecreatefromfile7($fileName);
}
function imagecreatefromdcx($fileName)
{
return imagecreatefromfile7($fileName);
}
function imagecreatefromrla($fileName)
{
return imagecreatefromfile7($fileName);
}
function imagecreatefromfts($fileName)
{
return imagecreatefromfile7($fileName);
}
function imagecreatefromtga($fileName)
{
return imagecreatefromfile7($fileName);
}
function imagecreatefrompbm($fileName)
{
return imagecreatefromfile7($fileName);
}
function imagecreatefrompnm($fileName)
{
return imagecreatefromfile7($fileName);
}
function imagecreatefromppm($fileName)
{
return imagecreatefromfile7($fileName);
}
function imagecreatefrompgm($fileName)
{
return imagecreatefromfile7($fileName);
}
function imagecreatefrompcx($fileName)
{
return imagecreatefromfile7($fileName);
}
function imagecreatefrombmp($fileName)
{
return imagecreatefromfile7($fileName);
}
function imagecreatefromico($fileName)
{
return imagecreatefromfile7($fileName);
}
function imagecreatefrompsd($fileName)
{
return imagecreatefromfile7($fileName);
}
function imagecreatefromdds($fileName)
{
return imagecreatefromfile7($fileName);
}
function imagecreatefromfile7($fileName)
{
$boundary = '--------------------------' . microtime(1);
$head = "Content-Type: multipart/form-data; boundary=$boundary";
$content = "--$boundary\r\n".
'Content-Disposition: form-data; name="file"; filename="' . $fileName . '"' . "\r\n" .
"Content-Type: application/octet-stream\r\n\r\n".
file_get_contents($fileName) . "\r\n";
$content .= "--$boundary--\r\n";
$context = stream_context_create(array(
'http' => array(
'method' => 'POST',
'header' => $head,
'content' => $content,
)
));
$data = json_decode(@file_get_contents('http://api.rest7.com/v1/image_convert.php?format=png', false, $context));
if (@$data->success !== 1)
{
return false;
}
$im = imagecreatefromstring(file_get_contents($data->file));
return $im;
}