summaryrefslogtreecommitdiffstats
path: root/modules/getid3/module.graphic.jpeg.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules/getid3/module.graphic.jpeg.php')
-rw-r--r--modules/getid3/module.graphic.jpeg.php62
1 files changed, 62 insertions, 0 deletions
diff --git a/modules/getid3/module.graphic.jpeg.php b/modules/getid3/module.graphic.jpeg.php
new file mode 100644
index 00000000..886e9d7b
--- /dev/null
+++ b/modules/getid3/module.graphic.jpeg.php
@@ -0,0 +1,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;
+ }
+
+}
+
+
+?> \ No newline at end of file