Mercurial > judyates
view e2gallerypro/e2upload/Backend/Assets/getid3/module.graphic.gif.php @ 18:903b91a97990 judyates
updated site to use google analytics
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Mon, 11 Jul 2011 03:06:13 -0400 |
parents | 3f6b44aa6b35 |
children |
line wrap: on
line source
1 <?php2 // +----------------------------------------------------------------------+3 // | PHP version 5 |4 // +----------------------------------------------------------------------+5 // | Copyright (c) 2002-2006 James Heinrich, Allan Hansen |6 // +----------------------------------------------------------------------+7 // | This source file is subject to version 2 of the GPL license, |8 // | that is bundled with this package in the file license.txt and is |9 // | available through the world-wide-web at the following url: |10 // | http://www.gnu.org/copyleft/gpl.html |11 // +----------------------------------------------------------------------+12 // | getID3() - http://getid3.sourceforge.net or http://www.getid3.org |13 // +----------------------------------------------------------------------+14 // | Authors: James Heinrich <infoØgetid3*org> |15 // | Allan Hansen <ahØartemis*dk> |16 // +----------------------------------------------------------------------+17 // | module.graphic.gif.php |18 // | Module for analyzing CompuServe GIF graphic files. |19 // | dependencies: NONE |20 // +----------------------------------------------------------------------+21 //22 // $Id: module.graphic.gif.php,v 1.2 2006/11/02 10:48:02 ah Exp $26 class getid3_gif extends getid3_handler27 {29 public function Analyze() {31 $getid3 = $this->getid3;33 $getid3->info['fileformat'] = 'gif';34 $getid3->info['video']['dataformat'] = 'gif';35 $getid3->info['video']['lossless'] = true;36 $getid3->info['video']['pixel_aspect_ratio'] = (float)1;38 $getid3->info['gif']['header'] = array ();39 $info_gif_header = &$getid3->info['gif']['header'];41 fseek($getid3->fp, $getid3->info['avdataoffset'], SEEK_SET);42 $gif_header = fread($getid3->fp, 13);44 // Magic bytes45 $info_gif_header['raw']['identifier'] = 'GIF';47 getid3_lib::ReadSequence('LittleEndian2Int', $info_gif_header['raw'], $gif_header, 3,48 array (49 'version' => -3, // string50 'width' => 2,51 'height' => 2,52 'flags' => 1,53 'bg_color_index' => 1,54 'aspect_ratio' => 155 )56 );58 $getid3->info['video']['resolution_x'] = $info_gif_header['raw']['width'];59 $getid3->info['video']['resolution_y'] = $info_gif_header['raw']['height'];60 $getid3->info['gif']['version'] = $info_gif_header['raw']['version'];62 $info_gif_header['flags']['global_color_table'] = (bool)($info_gif_header['raw']['flags'] & 0x80);64 if ($info_gif_header['raw']['flags'] & 0x80) {65 // Number of bits per primary color available to the original image, minus 166 $info_gif_header['bits_per_pixel'] = 3 * ((($info_gif_header['raw']['flags'] & 0x70) >> 4) + 1);67 } else {68 $info_gif_header['bits_per_pixel'] = 0;69 }71 $info_gif_header['flags']['global_color_sorted'] = (bool)($info_gif_header['raw']['flags'] & 0x40);72 if ($info_gif_header['flags']['global_color_table']) {73 // the number of bytes contained in the Global Color Table. To determine that74 // actual size of the color table, raise 2 to [the value of the field + 1]75 $info_gif_header['global_color_size'] = pow(2, ($info_gif_header['raw']['flags'] & 0x07) + 1);76 $getid3->info['video']['bits_per_sample'] = ($info_gif_header['raw']['flags'] & 0x07) + 1;77 } else {78 $info_gif_header['global_color_size'] = 0;79 }81 if ($info_gif_header['raw']['aspect_ratio'] != 0) {82 // Aspect Ratio = (Pixel Aspect Ratio + 15) / 6483 $info_gif_header['aspect_ratio'] = ($info_gif_header['raw']['aspect_ratio'] + 15) / 64;84 }86 return true;87 }89 }92 ?>