ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 ?>