GetId3() by James Heinrich info@.nosp@m.geti.nosp@m.d3.or.nosp@m.g //.
More...
GetId3() by James Heinrich info@.nosp@m.geti.nosp@m.d3.or.nosp@m.g //.
module for analyzing GIF Image files
- Author
- James Heinrich info@.nosp@m.geti.nosp@m.d3.or.nosp@m.g http://www.getid3.org
Definition at line 29 of file Gif.php.
◆ analyze()
GetId3\Module\Graphic\Gif::analyze |
( |
| ) |
|
- Returns
- boolean
Definition at line 36 of file Gif.php.
References $info, GetId3\Handler\BaseHandler\fread(), GetId3\Handler\BaseHandler\fseek(), GetId3\Lib\Helper\LittleEndian2Int(), and GetId3\Lib\Helper\PrintHexBytes().
38 $info = &$this->getid3->info;
40 $info[
'fileformat'] =
'gif';
41 $info[
'video'][
'dataformat'] =
'gif';
42 $info[
'video'][
'lossless'] =
true;
43 $info[
'video'][
'pixel_aspect_ratio'] = (float) 1;
45 fseek($this->getid3->fp,
$info[
'avdataoffset'], SEEK_SET);
46 $GIFheader =
fread($this->getid3->fp, 13);
49 $info[
'gif'][
'header'][
'raw'][
'identifier'] = substr($GIFheader, $offset, 3);
53 if (
$info[
'gif'][
'header'][
'raw'][
'identifier'] != $magic) {
54 $info[
'error'][] =
'Expecting "'.Helper::PrintHexBytes($magic).
'" at offset '.
$info[
'avdataoffset'].
', found "'.
Helper::PrintHexBytes(
$info[
'gif'][
'header'][
'raw'][
'identifier']).
'"';
55 unset(
$info[
'fileformat']);
61 $info[
'gif'][
'header'][
'raw'][
'version'] = substr($GIFheader, $offset, 3);
74 $info[
'video'][
'resolution_x'] =
$info[
'gif'][
'header'][
'raw'][
'width'];
75 $info[
'video'][
'resolution_y'] =
$info[
'gif'][
'header'][
'raw'][
'height'];
76 $info[
'gif'][
'version'] =
$info[
'gif'][
'header'][
'raw'][
'version'];
77 $info[
'gif'][
'header'][
'flags'][
'global_color_table'] = (bool) (
$info[
'gif'][
'header'][
'raw'][
'flags'] & 0x80);
78 if (
$info[
'gif'][
'header'][
'raw'][
'flags'] & 0x80) {
80 $info[
'gif'][
'header'][
'bits_per_pixel'] = 3 * (((
$info[
'gif'][
'header'][
'raw'][
'flags'] & 0x70) >> 4) + 1);
82 $info[
'gif'][
'header'][
'bits_per_pixel'] = 0;
84 $info[
'gif'][
'header'][
'flags'][
'global_color_sorted'] = (bool) (
$info[
'gif'][
'header'][
'raw'][
'flags'] & 0x40);
85 if (
$info[
'gif'][
'header'][
'flags'][
'global_color_table']) {
88 $info[
'gif'][
'header'][
'global_color_size'] = pow(2, (
$info[
'gif'][
'header'][
'raw'][
'flags'] & 0x07) + 1);
89 $info[
'video'][
'bits_per_sample'] = (
$info[
'gif'][
'header'][
'raw'][
'flags'] & 0x07) + 1;
91 $info[
'gif'][
'header'][
'global_color_size'] = 0;
93 if (
$info[
'gif'][
'header'][
'raw'][
'aspect_ratio'] != 0) {
95 $info[
'gif'][
'header'][
'aspect_ratio'] = (
$info[
'gif'][
'header'][
'raw'][
'aspect_ratio'] + 15) / 64;
static PrintHexBytes($string, $hex=true, $spaces=true, $htmlencoding='UTF-8')
fseek($bytes, $whence=SEEK_SET)
static LittleEndian2Int($byteword, $signed=false)
◆ GetLSBits()
GetId3\Module\Graphic\Gif::GetLSBits |
( |
|
$bits | ) |
|
string $bitbuffer
- Parameters
-
- Returns
- type
Definition at line 192 of file Gif.php.
References GetId3\Handler\BaseHandler\fread().
194 static $bitbuffer =
'';
195 while (strlen($bitbuffer) < $bits) {
196 $bitbuffer = str_pad(decbin(ord(
fread($this->getid3->fp, 1))), 8,
'0', STR_PAD_LEFT).$bitbuffer;
198 $value = bindec(substr($bitbuffer, 0 - $bits));
199 $bitbuffer = substr($bitbuffer, 0, 0 - $bits);
The documentation for this class was generated from the following file:
- libs/composer/vendor/phansys/getid3/GetId3/Module/Graphic/Gif.php