ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
module.graphic.svg.php
Go to the documentation of this file.
1<?php
4// available at http://getid3.sourceforge.net //
5// or http://www.getid3.org //
7// See readme.txt for more details //
9// //
10// module.graphic.svg.php //
11// module for analyzing SVG Image files //
12// dependencies: NONE //
13// author: Bryce Harrington <bryceØbryceharrington*org> //
14// ///
16
17
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?>
fseek($bytes, $whence=SEEK_SET)
Definition: getid3.php:1697
fread($bytes)
Definition: getid3.php:1685
LittleEndian2Int($byteword, $signed=false)
Definition: getid3.lib.php:266
getID3() by James Heinrich info@getid3.org //
getid3_svg(&$fd, &$ThisFileInfo)