rlm@3: <?php
rlm@3: // +----------------------------------------------------------------------+
rlm@3: // | PHP version 5                                                        |
rlm@3: // +----------------------------------------------------------------------+
rlm@3: // | Copyright (c) 2002-2006 James Heinrich, Allan Hansen                 |
rlm@3: // +----------------------------------------------------------------------+
rlm@3: // | This source file is subject to version 2 of the GPL license,         |
rlm@3: // | that is bundled with this package in the file license.txt and is     |
rlm@3: // | available through the world-wide-web at the following url:           |
rlm@3: // | http://www.gnu.org/copyleft/gpl.html                                 |
rlm@3: // +----------------------------------------------------------------------+
rlm@3: // | getID3() - http://getid3.sourceforge.net or http://www.getid3.org    |
rlm@3: // +----------------------------------------------------------------------+
rlm@3: // | Authors: James Heinrich <infoØgetid3*org>                            |
rlm@3: // |          Allan Hansen <ahØartemis*dk>                                |
rlm@3: // +----------------------------------------------------------------------+
rlm@3: // | module.graphic.jpeg.php                                              |
rlm@3: // | Module for analyzing JPEG graphic files.                             |
rlm@3: // | dependencies: exif support in PHP (optional)                         |
rlm@3: // +----------------------------------------------------------------------+
rlm@3: //
rlm@3: // $Id: module.graphic.jpeg.php,v 1.4 2006/11/02 10:48:02 ah Exp $
rlm@3: 
rlm@3:         
rlm@3:         
rlm@3: class getid3_jpeg extends getid3_handler
rlm@3: {
rlm@3: 
rlm@3:     public function Analyze() {
rlm@3:         
rlm@3:         $getid3 = $this->getid3;
rlm@3: 
rlm@3:         $getid3->info['fileformat']                  = 'jpg';
rlm@3:         $getid3->info['video']['dataformat']         = 'jpg';
rlm@3:         $getid3->info['video']['lossless']           = false;
rlm@3:         $getid3->info['video']['bits_per_sample']    = 24;
rlm@3:         $getid3->info['video']['pixel_aspect_ratio'] = (float)1;
rlm@3: 
rlm@3:         fseek($getid3->fp, $getid3->info['avdataoffset'], SEEK_SET);
rlm@3: 
rlm@3:         list($getid3->info['video']['resolution_x'], $getid3->info['video']['resolution_y'], $type) = getimagesize($getid3->filename);
rlm@3:         
rlm@3:         if ($type != 2) {
rlm@3:             throw new getid3_exception('File detected as JPEG, but is currupt.');
rlm@3:         }
rlm@3: 
rlm@3:         if (function_exists('exif_read_data')) {
rlm@3: 
rlm@3:             $getid3->info['jpg']['exif'] = exif_read_data($getid3->filename, '', true, false);
rlm@3: 
rlm@3:         } else {
rlm@3: 
rlm@3:             $getid3->warning('EXIF parsing only available when compiled with --enable-exif (or php_exif.dll enabled for Windows).');
rlm@3:         }
rlm@3: 
rlm@3:         return true;
rlm@3:     }
rlm@3: 
rlm@3: }
rlm@3: 
rlm@3: 
rlm@3: ?>