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.jpeg.php |
|
rlm@3
|
18 // | Module for analyzing JPEG graphic files. |
|
rlm@3
|
19 // | dependencies: exif support in PHP (optional) |
|
rlm@3
|
20 // +----------------------------------------------------------------------+
|
rlm@3
|
21 //
|
rlm@3
|
22 // $Id: module.graphic.jpeg.php,v 1.4 2006/11/02 10:48:02 ah Exp $
|
rlm@3
|
23
|
rlm@3
|
24
|
rlm@3
|
25
|
rlm@3
|
26 class getid3_jpeg 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'] = 'jpg';
|
rlm@3
|
34 $getid3->info['video']['dataformat'] = 'jpg';
|
rlm@3
|
35 $getid3->info['video']['lossless'] = false;
|
rlm@3
|
36 $getid3->info['video']['bits_per_sample'] = 24;
|
rlm@3
|
37 $getid3->info['video']['pixel_aspect_ratio'] = (float)1;
|
rlm@3
|
38
|
rlm@3
|
39 fseek($getid3->fp, $getid3->info['avdataoffset'], SEEK_SET);
|
rlm@3
|
40
|
rlm@3
|
41 list($getid3->info['video']['resolution_x'], $getid3->info['video']['resolution_y'], $type) = getimagesize($getid3->filename);
|
rlm@3
|
42
|
rlm@3
|
43 if ($type != 2) {
|
rlm@3
|
44 throw new getid3_exception('File detected as JPEG, but is currupt.');
|
rlm@3
|
45 }
|
rlm@3
|
46
|
rlm@3
|
47 if (function_exists('exif_read_data')) {
|
rlm@3
|
48
|
rlm@3
|
49 $getid3->info['jpg']['exif'] = exif_read_data($getid3->filename, '', true, false);
|
rlm@3
|
50
|
rlm@3
|
51 } else {
|
rlm@3
|
52
|
rlm@3
|
53 $getid3->warning('EXIF parsing only available when compiled with --enable-exif (or php_exif.dll enabled for Windows).');
|
rlm@3
|
54 }
|
rlm@3
|
55
|
rlm@3
|
56 return true;
|
rlm@3
|
57 }
|
rlm@3
|
58
|
rlm@3
|
59 }
|
rlm@3
|
60
|
rlm@3
|
61
|
rlm@3
|
62 ?> |