diff e2gallerypro/e2upload/Backend/Assets/getid3/module.graphic.gif.php @ 3:3f6b44aa6b35 judyates

[svn r4] added ability to buy stuff, from a Prints page, but it doesn't work well with the css, and it also has not been fitted into the perl make system.
author rlm
date Mon, 22 Feb 2010 08:02:39 -0500
parents
children
line wrap: on
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/e2gallerypro/e2upload/Backend/Assets/getid3/module.graphic.gif.php	Mon Feb 22 08:02:39 2010 -0500
     1.3 @@ -0,0 +1,92 @@
     1.4 +<?php
     1.5 +// +----------------------------------------------------------------------+
     1.6 +// | PHP version 5                                                        |
     1.7 +// +----------------------------------------------------------------------+
     1.8 +// | Copyright (c) 2002-2006 James Heinrich, Allan Hansen                 |
     1.9 +// +----------------------------------------------------------------------+
    1.10 +// | This source file is subject to version 2 of the GPL license,         |
    1.11 +// | that is bundled with this package in the file license.txt and is     |
    1.12 +// | available through the world-wide-web at the following url:           |
    1.13 +// | http://www.gnu.org/copyleft/gpl.html                                 |
    1.14 +// +----------------------------------------------------------------------+
    1.15 +// | getID3() - http://getid3.sourceforge.net or http://www.getid3.org    |
    1.16 +// +----------------------------------------------------------------------+
    1.17 +// | Authors: James Heinrich <infoØgetid3*org>                            |
    1.18 +// |          Allan Hansen <ahØartemis*dk>                                |
    1.19 +// +----------------------------------------------------------------------+
    1.20 +// | module.graphic.gif.php                                               |
    1.21 +// | Module for analyzing CompuServe GIF graphic files.                   |
    1.22 +// | dependencies: NONE                                                   |
    1.23 +// +----------------------------------------------------------------------+
    1.24 +//
    1.25 +// $Id: module.graphic.gif.php,v 1.2 2006/11/02 10:48:02 ah Exp $
    1.26 +
    1.27 +        
    1.28 +        
    1.29 +class getid3_gif extends getid3_handler
    1.30 +{
    1.31 +
    1.32 +    public function Analyze() {
    1.33 +        
    1.34 +        $getid3 = $this->getid3;
    1.35 +
    1.36 +        $getid3->info['fileformat']                  = 'gif';
    1.37 +        $getid3->info['video']['dataformat']         = 'gif';
    1.38 +        $getid3->info['video']['lossless']           = true;
    1.39 +        $getid3->info['video']['pixel_aspect_ratio'] = (float)1;
    1.40 +        
    1.41 +        $getid3->info['gif']['header'] = array ();
    1.42 +        $info_gif_header = &$getid3->info['gif']['header'];
    1.43 +
    1.44 +        fseek($getid3->fp, $getid3->info['avdataoffset'], SEEK_SET);
    1.45 +        $gif_header = fread($getid3->fp, 13);
    1.46 +
    1.47 +        // Magic bytes
    1.48 +        $info_gif_header['raw']['identifier'] = 'GIF';
    1.49 +        
    1.50 +        getid3_lib::ReadSequence('LittleEndian2Int', $info_gif_header['raw'], $gif_header, 3,
    1.51 +            array (
    1.52 +                'version'        => -3,      // string
    1.53 +                'width'          => 2,
    1.54 +                'height'         => 2,
    1.55 +                'flags'          => 1,
    1.56 +                'bg_color_index' => 1,
    1.57 +                'aspect_ratio'   => 1
    1.58 +            )
    1.59 +        );
    1.60 +
    1.61 +        $getid3->info['video']['resolution_x'] = $info_gif_header['raw']['width'];
    1.62 +        $getid3->info['video']['resolution_y'] = $info_gif_header['raw']['height'];
    1.63 +        $getid3->info['gif']['version']        = $info_gif_header['raw']['version'];
    1.64 +        
    1.65 +        $info_gif_header['flags']['global_color_table'] = (bool)($info_gif_header['raw']['flags'] & 0x80);
    1.66 +        
    1.67 +        if ($info_gif_header['raw']['flags'] & 0x80) {
    1.68 +            // Number of bits per primary color available to the original image, minus 1
    1.69 +            $info_gif_header['bits_per_pixel']  = 3 * ((($info_gif_header['raw']['flags'] & 0x70) >> 4) + 1);
    1.70 +        } else {
    1.71 +            $info_gif_header['bits_per_pixel']  = 0;
    1.72 +        }
    1.73 +        
    1.74 +        $info_gif_header['flags']['global_color_sorted'] = (bool)($info_gif_header['raw']['flags'] & 0x40);
    1.75 +        if ($info_gif_header['flags']['global_color_table']) {
    1.76 +            // the number of bytes contained in the Global Color Table. To determine that
    1.77 +            // actual size of the color table, raise 2 to [the value of the field + 1]
    1.78 +            $info_gif_header['global_color_size'] = pow(2, ($info_gif_header['raw']['flags'] & 0x07) + 1);
    1.79 +            $getid3->info['video']['bits_per_sample']           = ($info_gif_header['raw']['flags'] & 0x07) + 1;
    1.80 +        } else {
    1.81 +            $info_gif_header['global_color_size'] = 0;
    1.82 +        }
    1.83 +        
    1.84 +        if ($info_gif_header['raw']['aspect_ratio'] != 0) {
    1.85 +            // Aspect Ratio = (Pixel Aspect Ratio + 15) / 64
    1.86 +            $info_gif_header['aspect_ratio'] = ($info_gif_header['raw']['aspect_ratio'] + 15) / 64;
    1.87 +        }
    1.88 +
    1.89 +        return true;
    1.90 +    }
    1.91 +
    1.92 +}
    1.93 +
    1.94 +
    1.95 +?>
    1.96 \ No newline at end of file