annotate e2gallerypro/e2upload/Backend/Assets/getid3/module.graphic.gif.php @ 12:2f433df9b961 judyates

[svn r13] Modified esgallery source to enable multiple paypal buttons; got the photo gallery operational and tested.
author rlm
date Mon, 12 Apr 2010 03:24:08 -0400
parents 3f6b44aa6b35
children
rev   line source
rlm@3 1 <?php
rlm@3 2 // +----------------------------------------------------------------------+
rlm@3 3 // | PHP version 5 |
rlm@3 4 // +----------------------------------------------------------------------+
rlm@3 5 // | Copyright (c) 2002-2006 James Heinrich, Allan Hansen |
rlm@3 6 // +----------------------------------------------------------------------+
rlm@3 7 // | This source file is subject to version 2 of the GPL license, |
rlm@3 8 // | that is bundled with this package in the file license.txt and is |
rlm@3 9 // | available through the world-wide-web at the following url: |
rlm@3 10 // | http://www.gnu.org/copyleft/gpl.html |
rlm@3 11 // +----------------------------------------------------------------------+
rlm@3 12 // | getID3() - http://getid3.sourceforge.net or http://www.getid3.org |
rlm@3 13 // +----------------------------------------------------------------------+
rlm@3 14 // | Authors: James Heinrich <infoØgetid3*org> |
rlm@3 15 // | Allan Hansen <ahØartemis*dk> |
rlm@3 16 // +----------------------------------------------------------------------+
rlm@3 17 // | module.graphic.gif.php |
rlm@3 18 // | Module for analyzing CompuServe GIF graphic files. |
rlm@3 19 // | dependencies: NONE |
rlm@3 20 // +----------------------------------------------------------------------+
rlm@3 21 //
rlm@3 22 // $Id: module.graphic.gif.php,v 1.2 2006/11/02 10:48:02 ah Exp $
rlm@3 23
rlm@3 24
rlm@3 25
rlm@3 26 class getid3_gif extends getid3_handler
rlm@3 27 {
rlm@3 28
rlm@3 29 public function Analyze() {
rlm@3 30
rlm@3 31 $getid3 = $this->getid3;
rlm@3 32
rlm@3 33 $getid3->info['fileformat'] = 'gif';
rlm@3 34 $getid3->info['video']['dataformat'] = 'gif';
rlm@3 35 $getid3->info['video']['lossless'] = true;
rlm@3 36 $getid3->info['video']['pixel_aspect_ratio'] = (float)1;
rlm@3 37
rlm@3 38 $getid3->info['gif']['header'] = array ();
rlm@3 39 $info_gif_header = &$getid3->info['gif']['header'];
rlm@3 40
rlm@3 41 fseek($getid3->fp, $getid3->info['avdataoffset'], SEEK_SET);
rlm@3 42 $gif_header = fread($getid3->fp, 13);
rlm@3 43
rlm@3 44 // Magic bytes
rlm@3 45 $info_gif_header['raw']['identifier'] = 'GIF';
rlm@3 46
rlm@3 47 getid3_lib::ReadSequence('LittleEndian2Int', $info_gif_header['raw'], $gif_header, 3,
rlm@3 48 array (
rlm@3 49 'version' => -3, // string
rlm@3 50 'width' => 2,
rlm@3 51 'height' => 2,
rlm@3 52 'flags' => 1,
rlm@3 53 'bg_color_index' => 1,
rlm@3 54 'aspect_ratio' => 1
rlm@3 55 )
rlm@3 56 );
rlm@3 57
rlm@3 58 $getid3->info['video']['resolution_x'] = $info_gif_header['raw']['width'];
rlm@3 59 $getid3->info['video']['resolution_y'] = $info_gif_header['raw']['height'];
rlm@3 60 $getid3->info['gif']['version'] = $info_gif_header['raw']['version'];
rlm@3 61
rlm@3 62 $info_gif_header['flags']['global_color_table'] = (bool)($info_gif_header['raw']['flags'] & 0x80);
rlm@3 63
rlm@3 64 if ($info_gif_header['raw']['flags'] & 0x80) {
rlm@3 65 // Number of bits per primary color available to the original image, minus 1
rlm@3 66 $info_gif_header['bits_per_pixel'] = 3 * ((($info_gif_header['raw']['flags'] & 0x70) >> 4) + 1);
rlm@3 67 } else {
rlm@3 68 $info_gif_header['bits_per_pixel'] = 0;
rlm@3 69 }
rlm@3 70
rlm@3 71 $info_gif_header['flags']['global_color_sorted'] = (bool)($info_gif_header['raw']['flags'] & 0x40);
rlm@3 72 if ($info_gif_header['flags']['global_color_table']) {
rlm@3 73 // the number of bytes contained in the Global Color Table. To determine that
rlm@3 74 // actual size of the color table, raise 2 to [the value of the field + 1]
rlm@3 75 $info_gif_header['global_color_size'] = pow(2, ($info_gif_header['raw']['flags'] & 0x07) + 1);
rlm@3 76 $getid3->info['video']['bits_per_sample'] = ($info_gif_header['raw']['flags'] & 0x07) + 1;
rlm@3 77 } else {
rlm@3 78 $info_gif_header['global_color_size'] = 0;
rlm@3 79 }
rlm@3 80
rlm@3 81 if ($info_gif_header['raw']['aspect_ratio'] != 0) {
rlm@3 82 // Aspect Ratio = (Pixel Aspect Ratio + 15) / 64
rlm@3 83 $info_gif_header['aspect_ratio'] = ($info_gif_header['raw']['aspect_ratio'] + 15) / 64;
rlm@3 84 }
rlm@3 85
rlm@3 86 return true;
rlm@3 87 }
rlm@3 88
rlm@3 89 }
rlm@3 90
rlm@3 91
rlm@3 92 ?>