1 | <?php |
---|
2 | ///////////////////////////////////////////////////////////////// |
---|
3 | /// getID3() by James Heinrich <info@getid3.org> // |
---|
4 | // available at http://getid3.sourceforge.net // |
---|
5 | // or http://www.getid3.org // |
---|
6 | ///////////////////////////////////////////////////////////////// |
---|
7 | // See readme.txt for more details // |
---|
8 | ///////////////////////////////////////////////////////////////// |
---|
9 | // // |
---|
10 | // module.graphic.svg.php // |
---|
11 | // module for analyzing SVG Image files // |
---|
12 | // dependencies: NONE // |
---|
13 | // author: Bryce Harrington <bryceØbryceharrington*org> // |
---|
14 | // /// |
---|
15 | ///////////////////////////////////////////////////////////////// |
---|
16 | |
---|
17 | |
---|
18 | class getid3_svg |
---|
19 | { |
---|
20 | |
---|
21 | |
---|
22 | function getid3_svg(&$fd, &$ThisFileInfo) { |
---|
23 | fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET); |
---|
24 | |
---|
25 | // I'm making this up, please modify as appropriate |
---|
26 | $SVGheader = fread($fd, 32); |
---|
27 | $ThisFileInfo['svg']['magic'] = substr($SVGheader, 0, 4); |
---|
28 | if ($ThisFileInfo['svg']['magic'] == 'aBcD') { |
---|
29 | |
---|
30 | $ThisFileInfo['fileformat'] = 'svg'; |
---|
31 | $ThisFileInfo['video']['dataformat'] = 'svg'; |
---|
32 | $ThisFileInfo['video']['lossless'] = true; |
---|
33 | $ThisFileInfo['video']['bits_per_sample'] = 24; |
---|
34 | $ThisFileInfo['video']['pixel_aspect_ratio'] = (float) 1; |
---|
35 | |
---|
36 | $ThisFileInfo['svg']['width'] = getid3_lib::LittleEndian2Int(substr($fileData, 4, 4)); |
---|
37 | $ThisFileInfo['svg']['height'] = getid3_lib::LittleEndian2Int(substr($fileData, 8, 4)); |
---|
38 | |
---|
39 | $ThisFileInfo['video']['resolution_x'] = $ThisFileInfo['svg']['width']; |
---|
40 | $ThisFileInfo['video']['resolution_y'] = $ThisFileInfo['svg']['height']; |
---|
41 | |
---|
42 | return true; |
---|
43 | } |
---|
44 | $ThisFileInfo['error'][] = 'Did not find SVG magic bytes "aBcD" at '.$ThisFileInfo['avdataoffset']; |
---|
45 | unset($ThisFileInfo['fileformat']); |
---|
46 | return false; |
---|
47 | } |
---|
48 | |
---|
49 | } |
---|
50 | |
---|
51 | |
---|
52 | ?> |
---|