getID3() by James Heinrich info@.nosp@m.geti.nosp@m.d3.or.nosp@m.g //
More...
◆ Analyze()
Reimplemented from getid3_handler.
Definition at line 21 of file module.graphic.gif.php.
21 {
22 $info = &$this->getid3->info;
23
24 $info[
'fileformat'] =
'gif';
25 $info[
'video'][
'dataformat'] =
'gif';
26 $info[
'video'][
'lossless'] =
true;
27 $info[
'video'][
'pixel_aspect_ratio'] = (float) 1;
28
30 $GIFheader = $this->
fread(13);
31 $offset = 0;
32
33 $info[
'gif'][
'header'][
'raw'][
'identifier'] = substr($GIFheader, $offset, 3);
34 $offset += 3;
35
36 $magic = 'GIF';
37 if (
$info[
'gif'][
'header'][
'raw'][
'identifier'] != $magic) {
39 unset(
$info[
'fileformat']);
41 return false;
42 }
43
44 $info[
'gif'][
'header'][
'raw'][
'version'] = substr($GIFheader, $offset, 3);
45 $offset += 3;
47 $offset += 2;
49 $offset += 2;
51 $offset += 1;
53 $offset += 1;
55 $offset += 1;
56
57 $info[
'video'][
'resolution_x'] =
$info[
'gif'][
'header'][
'raw'][
'width'];
58 $info[
'video'][
'resolution_y'] =
$info[
'gif'][
'header'][
'raw'][
'height'];
59 $info[
'gif'][
'version'] =
$info[
'gif'][
'header'][
'raw'][
'version'];
60 $info[
'gif'][
'header'][
'flags'][
'global_color_table'] = (bool) (
$info[
'gif'][
'header'][
'raw'][
'flags'] & 0x80);
61 if (
$info[
'gif'][
'header'][
'raw'][
'flags'] & 0x80) {
62
63 $info[
'gif'][
'header'][
'bits_per_pixel'] = 3 * (((
$info[
'gif'][
'header'][
'raw'][
'flags'] & 0x70) >> 4) + 1);
64 } else {
65 $info[
'gif'][
'header'][
'bits_per_pixel'] = 0;
66 }
67 $info[
'gif'][
'header'][
'flags'][
'global_color_sorted'] = (bool) (
$info[
'gif'][
'header'][
'raw'][
'flags'] & 0x40);
68 if (
$info[
'gif'][
'header'][
'flags'][
'global_color_table']) {
69
70
71 $info[
'gif'][
'header'][
'global_color_size'] = pow(2, (
$info[
'gif'][
'header'][
'raw'][
'flags'] & 0x07) + 1);
72 $info[
'video'][
'bits_per_sample'] = (
$info[
'gif'][
'header'][
'raw'][
'flags'] & 0x07) + 1;
73 } else {
74 $info[
'gif'][
'header'][
'global_color_size'] = 0;
75 }
76 if (
$info[
'gif'][
'header'][
'raw'][
'aspect_ratio'] != 0) {
77
78 $info[
'gif'][
'header'][
'aspect_ratio'] = (
$info[
'gif'][
'header'][
'raw'][
'aspect_ratio'] + 15) / 64;
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167 return true;
168 }
fseek($bytes, $whence=SEEK_SET)
static PrintHexBytes($string, $hex=true, $spaces=true, $htmlencoding='UTF-8')
static LittleEndian2Int($byteword, $signed=false)
References $info, getid3_handler\error(), getid3_handler\fread(), getid3_handler\fseek(), getid3_lib\LittleEndian2Int(), and getid3_lib\PrintHexBytes().
◆ GetLSBits()
getid3_gif::GetLSBits |
( |
|
$bits | ) |
|
Definition at line 171 of file module.graphic.gif.php.
171 {
172 static $bitbuffer = '';
173 while (strlen($bitbuffer) < $bits) {
174 $bitbuffer = str_pad(decbin(ord($this->
fread(1))), 8,
'0', STR_PAD_LEFT).$bitbuffer;
175 }
176 $value = bindec(substr($bitbuffer, 0 - $bits));
177 $bitbuffer = substr($bitbuffer, 0, 0 - $bits);
178
179 return $value;
180 }
References getid3_handler\fread().
The documentation for this class was generated from the following file: