blob: 886e9d7b3873b646eb1a753e34f56ad547c46023 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
<?php
// +----------------------------------------------------------------------+
// | PHP version 5 |
// +----------------------------------------------------------------------+
// | Copyright (c) 2002-2006 James Heinrich, Allan Hansen |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2 of the GPL license, |
// | that is bundled with this package in the file license.txt and is |
// | available through the world-wide-web at the following url: |
// | http://www.gnu.org/copyleft/gpl.html |
// +----------------------------------------------------------------------+
// | getID3() - http://getid3.sourceforge.net or http://www.getid3.org |
// +----------------------------------------------------------------------+
// | Authors: James Heinrich <info�getid3*org> |
// | Allan Hansen <ah�artemis*dk> |
// +----------------------------------------------------------------------+
// | module.graphic.jpeg.php |
// | Module for analyzing JPEG graphic files. |
// | dependencies: exif support in PHP (optional) |
// +----------------------------------------------------------------------+
//
// $Id: module.graphic.jpeg.php,v 1.4 2006/11/02 10:48:02 ah Exp $
class getid3_jpeg extends getid3_handler
{
public function Analyze() {
$getid3 = $this->getid3;
$getid3->info['fileformat'] = 'jpg';
$getid3->info['video']['dataformat'] = 'jpg';
$getid3->info['video']['lossless'] = false;
$getid3->info['video']['bits_per_sample'] = 24;
$getid3->info['video']['pixel_aspect_ratio'] = (float)1;
fseek($getid3->fp, $getid3->info['avdataoffset'], SEEK_SET);
list($getid3->info['video']['resolution_x'], $getid3->info['video']['resolution_y'], $type) = getimagesize($getid3->filename);
if ($type != 2) {
throw new getid3_exception('File detected as JPEG, but is currupt.');
}
if (function_exists('exif_read_data')) {
$getid3->info['jpg']['exif'] = exif_read_data($getid3->filename, '', true, false);
} else {
$getid3->warning('EXIF parsing only available when compiled with --enable-exif (or php_exif.dll enabled for Windows).');
}
return true;
}
}
?>
|