source: extensions/charlies_content/getid3/getid3/module.graphic.jpeg.php @ 3318

Last change on this file since 3318 was 3318, checked in by vdigital, 15 years ago

+ Add Charlies' content to depository

  • Property svn:keywords set to Author Date Id Revision
File size: 2.5 KB
Line 
1<?php
2// +----------------------------------------------------------------------+
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.jpeg.php                                              |
18// | Module for analyzing JPEG graphic files.                             |
19// | dependencies: exif support in PHP (optional)                         |
20// +----------------------------------------------------------------------+
21//
22// $Id: module.graphic.jpeg.php 3318 2009-05-20 21:54:10Z vdigital $
23
24       
25       
26class getid3_jpeg extends getid3_handler
27{
28
29    public function Analyze() {
30       
31        $getid3 = $this->getid3;
32
33        $getid3->info['fileformat']                  = 'jpg';
34        $getid3->info['video']['dataformat']         = 'jpg';
35        $getid3->info['video']['lossless']           = false;
36        $getid3->info['video']['bits_per_sample']    = 24;
37        $getid3->info['video']['pixel_aspect_ratio'] = (float)1;
38
39        fseek($getid3->fp, $getid3->info['avdataoffset'], SEEK_SET);
40
41        list($getid3->info['video']['resolution_x'], $getid3->info['video']['resolution_y'], $type) = getimagesize($getid3->filename);
42       
43        if ($type != 2) {
44            throw new getid3_exception('File detected as JPEG, but is currupt.');
45        }
46
47        if (function_exists('exif_read_data')) {
48
49            $getid3->info['jpg']['exif'] = exif_read_data($getid3->filename, '', true, false);
50
51        } else {
52
53            $getid3->warning('EXIF parsing only available when compiled with --enable-exif (or php_exif.dll enabled for Windows).');
54        }
55
56        return true;
57    }
58
59}
60
61
62?>
Note: See TracBrowser for help on using the repository browser.