You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(121) |
Jun
(112) |
Jul
(42) |
Aug
(2) |
Sep
(2) |
Oct
(22) |
Nov
(2) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(7) |
Feb
(26) |
Mar
|
Apr
(1) |
May
(9) |
Jun
(3) |
Jul
(10) |
Aug
(6) |
Sep
(12) |
Oct
(50) |
Nov
|
Dec
|
2006 |
Jan
(8) |
Feb
(4) |
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
(14) |
Aug
|
Sep
(12) |
Oct
|
Nov
(28) |
Dec
(24) |
2007 |
Jan
(1) |
Feb
|
Mar
(2) |
Apr
(3) |
May
|
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
2008 |
Jan
(1) |
Feb
(1) |
Mar
|
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
|
Mar
(10) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2010 |
Jan
|
Feb
(9) |
Mar
(1) |
Apr
|
May
|
Jun
(1) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(2) |
From: Martin G. <gim...@us...> - 2004-05-07 19:21:58
|
Update of /cvsroot/pel/pel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10736 Modified Files: PelExifEntryShort.php Log Message: Fixes ported from libexif, see http://tinyurl.com/2r7re for the corresponding diff from the libexif source. Index: PelExifEntryShort.php =================================================================== RCS file: /cvsroot/pel/pel/PelExifEntryShort.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- PelExifEntryShort.php 7 May 2004 15:13:21 -0000 1.1 +++ PelExifEntryShort.php 7 May 2004 19:21:49 -0000 1.2 @@ -353,6 +353,8 @@ return 'Strobe return light not detected.'; case 0x0007: return 'Strobe return light detected.'; + case 0x0009: + return 'Flash fired, compulsatory flash mode'; case 0x000d: return 'Flash fired, compulsory flash mode, return light ' . 'not detected.'; @@ -388,6 +390,9 @@ case 0x004f: return 'Flash fired, compulsory flash mode, red-eye ' . 'reduction mode, return light detected.'; + case 0x0058: + return 'Flash did not fire, auto mode, red-eye ' . + 'reduction mode'; case 0x0059: return 'Flash fired, auto mode, red-eye reduction mode.'; case 0x005d: |
From: Martin G. <gim...@us...> - 2004-05-07 18:28:59
|
Update of /cvsroot/pel/pel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1079 Modified Files: README INSTALL TODO Log Message: Added a section about getting support to the README, and reformatted all three files. Index: README =================================================================== RCS file: /cvsroot/pel/pel/README,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- README 7 May 2004 15:13:21 -0000 1.1 +++ README 7 May 2004 18:28:49 -0000 1.2 @@ -5,18 +5,20 @@ Licensed under the GNU GPL, see COPYING for details. - -------------------- - Description - ======================== +Description +*********** PEL lets you read and write EXIF headers found in JPEG images easily. See the file INSTALL for an introduction to how PEL can be used by other applications. - - -------------------- - Features - ======================== +Please note that PEL is not mature, the API will probably change +before version 1.0 is reached. Go to the PEL development mailinglist +(look below) and share your ideas about how the API should look like. + + +Features +******** * Supports reading and writing all tags supported by the C libexif (http://sf.net/projects/libexif) library. @@ -24,9 +26,24 @@ * Extensible object-oriented design. - -------------------- - Credits - ======================== +Getting Support +*************** + +PEL is hosted on SourceForge and uses the tools found there for +support. For general discussions about the future development of PEL, +please use the development mailinglist. Remember to subscribe before +you post on the list, you can subscribe here: + + https://lists.sourceforge.net/lists/listinfo/pel-devel + +If you have a specific support request, a bug report, a feature +request, or maybe a patch, please use the corresponding tracker: + + https://sourceforge.net/tracker/?group_id=108380 + + +Credits +******* PEL started out as a port of libexif (http://sf.net/projects/libexif) from C to PHP. Index: TODO =================================================================== RCS file: /cvsroot/pel/pel/TODO,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- TODO 7 May 2004 15:13:21 -0000 1.1 +++ TODO 7 May 2004 18:28:49 -0000 1.2 @@ -5,9 +5,8 @@ Licensed under the GNU GPL, see COPYING for details. - -------------------- - TODO list for PEL - ======================== +TODO List for PEL +***************** In addition to the following list, then the source contains a number of comments beginning with 'TODO' which marks extra places where Index: INSTALL =================================================================== RCS file: /cvsroot/pel/pel/INSTALL,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- INSTALL 7 May 2004 15:13:21 -0000 1.1 +++ INSTALL 7 May 2004 18:28:49 -0000 1.2 @@ -5,18 +5,16 @@ Licensed under the GNU GPL, see COPYING for details. - -------------------- - Requirements - ======================== +Requirements +************ PEL requires PHP 5. The world is still waiting for the final release of this version, but in the mean time the release candidates should be used. PEL was developed with PHP 5 Release Candidate 2. - -------------------- - Installation - ======================== +Installation +************ PEL is installed by downloading it and unpacking it in a directory of your choice. Your application can then start using the classed @@ -24,9 +22,8 @@ entire JPEG image. - -------------------- - Usage - ======================== +Usage +***** Your application should include at least the PelDataWindow.php file for the definition of the basic PelDataWindow class which is used to |
From: Martin G. <gim...@us...> - 2004-05-07 18:07:20
|
Update of /cvsroot/pel/pel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29124 Added Files: make-release.sh Log Message: The script that will be used to make new PEL releases. --- NEW FILE: make-release.sh --- #!/bin/bash # # PEL: PHP EXIF Library. A library with support for reading and # writing all EXIF headers of JPEG images using PHP. # # Copyright (C) 2004 Martin Geisler <gim...@us...> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program in the file COPYING; if not, write to the # Free Software Foundation, Inc., 59 Temple Place, Suite 330, # Boston, MA 02111-1307 USA # $Id: make-release.sh,v 1.1 2004/05/07 18:07:08 gimpster Exp $ # This small script retrieves the latest version of PEL, packs it up # into two tarballs (gz and bz2) and a zip file, and then asks for # permission to upload these files to SourceForge. The files are # placed in the current directory. MAJOR=0 MINOR=1 VERSION=$MAJOR.$MINOR echo -n "Retrieving CVS snapshot from SourceForge... " cvs -Q -z3 export -kv -r HEAD -d pel-$VERSION pel echo "done." cd pel-$VERSION rm make-release.sh echo -n "Running phpDocumentor... " ../../phpdocumentor/phpdoc -q on -s on \ -dn PEL \ -ti 'PEL: PHP EXIF Library' \ -f '*.php' \ -t doc echo "done." cd .. echo -n "Creating pel-$VERSION.tar.gz... " tar -cz pel-$VERSION -f pel-$VERSION.tar.gz echo "done." echo -n "Creating pel-$VERSION.tar.bz2... " tar -cj pel-$VERSION -f pel-$VERSION.tar.bz2 echo "done." echo -n "Creating pel-$VERSION.zip... " zip -qr pel-$VERSION.zip pel-$VERSION echo "done." echo "Tag CVS with 'release-${MAJOR}_${MINOR}' and" read -p "upload files to SourceForge? [y/N] " -n 1 echo if [ "x$REPLY" == "xy" -o "x$REPLY" == "xY" ]; then echo -n "Tagging CVS with 'release-${MAJOR}_${MINOR}'... " cvs -Q tag release-${MAJOR}_${MINOR} echo "done." echo -n "Uploading files to SourceForge... " ncftpput upload.sourceforge.net /incoming \ pel-$VERSION.tar.gz \ pel-$VERSION.tar.bz2 \ pel-$VERSION.zip echo "done." else echo "Skipping tagging and upload." fi |
From: Martin G. <gim...@us...> - 2004-05-07 15:28:34
|
Update of /cvsroot/pel/pel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26420 Added Files: .cvsignore Log Message: Ignore the autogenerated documentation for now. --- NEW FILE: .cvsignore --- doc |
From: Martin G. <gim...@us...> - 2004-05-07 15:15:19
|
Update of /cvsroot/pel/pel/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23115 Added Files: dump-image.php edit-description.php test.jpg Log Message: Initial commit. --- NEW FILE: test.jpg --- (This appears to be a binary file; contents omitted.) --- NEW FILE: dump-image.php --- #!/usr/bin/php5 <?php /* PEL: PHP EXIF Library. A library with support for reading and * writing all EXIF headers of JPEG images using PHP. * * Copyright (C) 2004 Martin Geisler <gim...@us...> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program in the file COPYING; if not, write to the * Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307 USA */ /* $Id: dump-image.php,v 1.1 2004/05/07 15:15:08 gimpster Exp $ */ error_reporting(E_ALL); if ($argc < 2) { print('Usage: ' . $argv[0] . " <filename>\n"); exit(1); } include_once('../PelJpegData.php'); include_once('../PelDataWindow.php'); $data = new PelDataWindow(file_get_contents($argv[1])); $jpeg = new PelJpegData($data); print($jpeg); ?> --- NEW FILE: edit-description.php --- #!/usr/bin/php5 <?php /* PEL: PHP EXIF Library. A library with support for reading and * writing all EXIF headers of JPEG images using PHP. * * Copyright (C) 2004 Martin Geisler <gim...@us...> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program in the file COPYING; if not, write to the * Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307 USA */ /* $Id: edit-description.php,v 1.1 2004/05/07 15:15:08 gimpster Exp $ */ error_reporting(E_ALL); if ($argc < 2) { print('Usage: ' . $argv[0] . " <filename>\n"); exit(1); } include_once('../PelJpegData.php'); include_once('../PelDataWindow.php'); $data = new PelDataWindow(file_get_contents($argv[1])); $jpeg = new PelJpegData($data); $ifd0 = $jpeg->getSection(2)->getContent()->getIfd(); $exif = $ifd0->getSubIfd(PelExifTag::EXIF_IFD_POINTER); $ifd1 = $ifd0->getNextIfd(); $entry = $ifd0->getEntry(PelExifTag::IMAGE_DESCRIPTION); $entry->setAscii('Edited by PEL'); rename($argv[1], $argv[1] . '.' . time()); file_put_contents($argv[1], $jpeg->getBytes()); ?> |
From: Martin G. <gim...@us...> - 2004-05-07 15:14:08
|
Update of /cvsroot/pel/pel/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22958/test Log Message: Directory /cvsroot/pel/pel/test added to the repository |
From: Martin G. <gim...@us...> - 2004-05-07 15:13:36
|
Update of /cvsroot/pel/pel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22598 Added Files: INSTALL PelConvert.php PelDataWindow.php PelException.php PelExifData.php PelExifEntry.php PelExifEntryAscii.php PelExifEntryLong.php PelExifEntryNumber.php PelExifEntryRational.php PelExifEntryShort.php PelExifEntryUndefined.php PelExifFormat.php PelExifIfd.php PelExifTag.php PelJpegContent.php PelJpegData.php PelJpegMarker.php PelJpegSection.php README TODO Log Message: Initial commit. --- NEW FILE: PelJpegMarker.php --- <?php /* PEL: PHP EXIF Library. A library with support for reading and * writing all EXIF headers of JPEG images using PHP. * * Copyright (C) 2004 Martin Geisler <gim...@us...> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program in the file COPYING; if not, write to the * Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307 USA */ /* $Id: PelJpegMarker.php,v 1.1 2004/05/07 15:13:21 gimpster Exp $ */ /** * Classes for dealing with JPEG markers. * * @author Martin Geisler <gim...@us...> * @version $Revision: 1.1 $ * @license http://www.gnu.org/licenses/gpl.html GNU General Public * License (GPL) * @package PEL * @subpackage JPEG */ /** * Class with static methods for JPEG markers. * * This class defines the constants to be used whenever one refers to * a JPEG marker. All the methods defined are static, and they all * operate on one argument which should be one of the class constants. * They will all be denoted by PelJpegMarker in the documentation. * * @author Martin Geisler <gim...@us...> * @package PEL * @subpackage JPEG */ class PelJpegMarker { /** Encoding (baseline) */ const SOF0 = 0xC0; /** Encoding (extended sequential) */ const SOF1 = 0xC1; /** Encoding (progressive) */ const SOF2 = 0xC2; /** Encoding (lossless) */ const SOF3 = 0xC3; /** Define Huffman table */ const DHT = 0xC4; /** Encoding (differential sequential) */ const SOF5 = 0xC5; /** Encoding (differential progressive) */ const SOF6 = 0xC6; /** Encoding (differential lossless) */ const SOF7 = 0xC7; /** Extension */ const JPG = 0xC8; /** Encoding (extended sequential, arithmetic) */ const SOF9 = 0xC9; /** Encoding (progressive, arithmetic) */ const SOF10 = 0xCA; /** Encoding (lossless, arithmetic) */ const SOF11 = 0xCB; /** Define arithmetic coding conditioning */ const DAC = 0xCC; /** Encoding (differential sequential, arithmetic) */ const SOF13 = 0xCD; /** Encoding (differential progressive, arithmetic) */ const SOF14 = 0xCE; /** Encoding (differential lossless, arithmetic) */ const SOF15 = 0xCF; /** Restart 0 */ const RST0 = 0xD0; /** Restart 1 */ const RST1 = 0xD1; /** Restart 2 */ const RST2 = 0xD2; /** Restart 3 */ const RST3 = 0xD3; /** Restart 4 */ const RST4 = 0xD4; /** Restart 5 */ const RST5 = 0xD5; /** Restart 6 */ const RST6 = 0xD6; /** Restart 7 */ const RST7 = 0xD7; /** Start of image */ const SOI = 0xD8; /** End of image */ const EOI = 0xD9; /** Start of scan */ const SOS = 0xDA; /** Define quantization table */ const DQT = 0xDB; /** Define number of lines */ const DNL = 0xDC; /** Define restart interval */ const DRI = 0xDD; /** Define hierarchical progression */ const DHP = 0xDE; /** Expand reference component */ const EXP = 0xDF; /** Application segment 0 */ const APP0 = 0xE0; /** Application segment 1 */ const APP1 = 0xE1; /** Application segment 2 */ const APP2 = 0xE2; /** Application segment 3 */ const APP3 = 0xE3; /** Application segment 4 */ const APP4 = 0xE4; /** Application segment 5 */ const APP5 = 0xE5; /** Application segment 6 */ const APP6 = 0xE6; /** Application segment 7 */ const APP7 = 0xE7; /** Application segment 8 */ const APP8 = 0xE8; /** Application segment 9 */ const APP9 = 0xE9; /** Application segment 10 */ const APP10 = 0xEA; /** Application segment 11 */ const APP11 = 0xEB; /** Application segment 12 */ const APP12 = 0xEC; /** Application segment 13 */ const APP13 = 0xED; /** Application segment 14 */ const APP14 = 0xEE; /** Application segment 15 */ const APP15 = 0xEF; /** Extension 0 */ const JPG0 = 0xF0; /** Extension 1 */ const JPG1 = 0xF1; /** Extension 2 */ const JPG2 = 0xF2; /** Extension 3 */ const JPG3 = 0xF3; /** Extension 4 */ const JPG4 = 0xF4; /** Extension 5 */ const JPG5 = 0xF5; /** Extension 6 */ const JPG6 = 0xF6; /** Extension 7 */ const JPG7 = 0xF7; /** Extension 8 */ const JPG8 = 0xF8; /** Extension 9 */ const JPG9 = 0xF9; /** Extension 10 */ const JPG10 = 0xFA; /** Extension 11 */ const JPG11 = 0xFB; /** Extension 12 */ const JPG12 = 0xFC; /** Extension 13 */ const JPG13 = 0xFD; /** Comment */ const COM = 0xFE; /** * Check if a byte is a valid JPEG marker. * * @param PelJpegMarker the byte that will be checked. * * @return boolean if the byte is recognized true is returned, * otherwise false will be returned. */ static function isValidMarker($m) { return ($m >= self::SOF0 && $m <= self::COM); } /** * Turn a JPEG marker into bytes. * * @param PelJpegMarker the marker. * * @return string the marker as a string. This will be a string * with just a single byte since all JPEG markers are simply single * bytes. */ static function getBytes($m) { return chr($m); } /** * Return the short name for a marker. * * @param PelJpegMarker the marker. * * @return string the name of the marker, e.g., 'SOI' for the Start * of Image marker. */ static function getName($m) { switch ($m) { case self::SOF0: return 'SOF0'; case self::SOF1: return 'SOF1'; case self::SOF2: return 'SOF2'; case self::SOF3: return 'SOF3'; case self::SOF5: return 'SOF5'; case self::SOF6: return 'SOF6'; case self::SOF7: return 'SOF7'; case self::SOF9: return 'SOF9'; case self::SOF10: return 'SOF10'; case self::SOF11: return 'SOF11'; case self::SOF13: return 'SOF13'; case self::SOF14: return 'SOF14'; case self::SOF15: return 'SOF15'; case self::SOI: return 'SOI'; case self::EOI: return 'EOI'; case self::SOS: return 'SOS'; case self::COM: return 'COM'; case self::DHT: return 'DHT'; case self::JPG: return 'JPG'; case self::DAC: return 'DAC'; case self::RST0: return 'RST0'; case self::RST1: return 'RST1'; case self::RST2: return 'RST2'; case self::RST3: return 'RST3'; case self::RST4: return 'RST4'; case self::RST5: return 'RST5'; case self::RST6: return 'RST6'; case self::RST7: return 'RST7'; case self::DQT: return 'DQT'; case self::DNL: return 'DNL'; case self::DRI: return 'DRI'; case self::DHP: return 'DHP'; case self::EXP: return 'EXP'; case self::APP0: return 'APP0'; case self::APP1: return 'APP1'; case self::APP2: return 'APP2'; case self::APP3: return 'APP3'; case self::APP4: return 'APP4'; case self::APP5: return 'APP5'; case self::APP6: return 'APP6'; case self::APP7: return 'APP7'; case self::APP8: return 'APP8'; case self::APP9: return 'APP9'; case self::APP10: return 'APP10'; case self::APP11: return 'APP11'; case self::APP12: return 'APP12'; case self::APP13: return 'APP13'; case self::APP14: return 'APP14'; case self::APP15: return 'APP15'; case self::JPG0: return 'JPG0'; case self::JPG1: return 'JPG1'; case self::JPG2: return 'JPG2'; case self::JPG3: return 'JPG3'; case self::JPG4: return 'JPG4'; case self::JPG5: return 'JPG5'; case self::JPG6: return 'JPG6'; case self::JPG7: return 'JPG7'; case self::JPG8: return 'JPG8'; case self::JPG9: return 'JPG9'; case self::JPG10: return 'JPG10'; case self::JPG11: return 'JPG11'; case self::JPG12: return 'JPG12'; case self::JPG13: return 'JPG13'; case self::COM: return 'COM'; default: return sprintf('Unknown marker: 0x%02X', $m); } } /** * Returns a description of a JPEG marker. * * @param PelJpegMarker the marker. * * @return string the description of the marker. */ static function getDescription($m) { switch ($m) { case self::SOF0: return 'Encoding (baseline)'; case self::SOF1: return 'Encoding (extended sequential)'; case self::SOF2: return 'Encoding (progressive)'; case self::SOF3: return 'Encoding (lossless)'; case self::SOF5: return 'Encoding (differential sequential)'; case self::SOF6: return 'Encoding (differential progressive)'; case self::SOF7: return 'Encoding (differential lossless)'; case self::SOF9: return 'Encoding (extended sequential, arithmetic)'; case self::SOF10: return 'Encoding (progressive, arithmetic)'; case self::SOF11: return 'Encoding (lossless, arithmetic)'; case self::SOF13: return 'Encoding (differential sequential, arithmetic)'; case self::SOF14: return 'Encoding (differential progressive, arithmetic)'; case self::SOF15: return 'Encoding (differential lossless, arithmetic)'; case self::SOI: return 'Start of image'; case self::EOI: return 'End of image'; case self::SOS: return 'Start of scan'; case self::COM: return 'Comment'; case self::DHT: return 'Define Huffman table'; case self::JPG: return 'Extension'; case self::DAC: return 'Define arithmetic coding conditioning'; case self::RST0: return 'Restart 0'; case self::RST1: return 'Restart 1'; case self::RST2: return 'Restart 2'; case self::RST3: return 'Restart 3'; case self::RST4: return 'Restart 4'; case self::RST5: return 'Restart 5'; case self::RST6: return 'Restart 6'; case self::RST7: return 'Restart 7'; case self::DQT: return 'Define quantization table'; case self::DNL: return 'Define number of lines'; case self::DRI: return 'Define restart interval'; case self::DHP: return 'Define hierarchical progression'; case self::EXP: return 'Expand reference component'; case self::APP0: return 'Application segment 0'; case self::APP1: return 'Application segment 1'; case self::APP2: return 'Application segment 2'; case self::APP3: return 'Application segment 3'; case self::APP4: return 'Application segment 4'; case self::APP5: return 'Application segment 5'; case self::APP6: return 'Application segment 6'; case self::APP7: return 'Application segment 7'; case self::APP8: return 'Application segment 8'; case self::APP9: return 'Application segment 9'; case self::APP10: return 'Application segment 10'; case self::APP11: return 'Application segment 11'; case self::APP12: return 'Application segment 12'; case self::APP13: return 'Application segment 13'; case self::APP14: return 'Application segment 14'; case self::APP15: return 'Application segment 15'; case self::JPG0: return 'Extension 0'; case self::JPG1: return 'Extension 1'; case self::JPG2: return 'Extension 2'; case self::JPG3: return 'Extension 3'; case self::JPG4: return 'Extension 4'; case self::JPG5: return 'Extension 5'; case self::JPG6: return 'Extension 6'; case self::JPG7: return 'Extension 7'; case self::JPG8: return 'Extension 8'; case self::JPG9: return 'Extension 9'; case self::JPG10: return 'Extension 10'; case self::JPG11: return 'Extension 11'; case self::JPG12: return 'Extension 12'; case self::JPG13: return 'Extension 13'; case self::COM: return 'Comment'; default: return sprintf('Unknown marker: 0x%02X', $m); } } } ?> --- NEW FILE: PelJpegContent.php --- <?php /* PEL: PHP EXIF Library. A library with support for reading and * writing all EXIF headers of JPEG images using PHP. * * Copyright (C) 2004 Martin Geisler <gim...@us...> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program in the file COPYING; if not, write to the * Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307 USA */ /* $Id: PelJpegContent.php,v 1.1 2004/05/07 15:13:21 gimpster Exp $ */ /** * Class representing content in a JPEG file. * * @author Martin Geisler <gim...@us...> * @version $Revision: 1.1 $ * @license http://www.gnu.org/licenses/gpl.html GNU General Public * License (GPL) * @package PEL * @subpackage JPEG */ /** Class definition of {@link PelDataWindow}. */ include_once('PelDataWindow.php'); /** * Class representing content in a JPEG file. * * A JPEG file consists of a sequence of {@link PelJpegSection * sections} each of which has an associated {@link PelJpegMarker} * marker} and some content. This class represents the content, and * this basic type is just a simple holder of such content, * represented by a {@link PelDataWindow} object. The {@link * PelExifData} class is an example of more specialized JPEG content. * * @author Martin Geisler <gim...@us...> * @package PEL * @subpackage JPEG */ class PelJpegContent { private $data = null; function __construct(PelDataWindow $data) { $this->data = $data; } function getBytes() { return $this->data->getBytes(); } function getSize() { return $this->data->getSize(); } } ?> --- NEW FILE: PelExifTag.php --- <?php /* PEL: PHP EXIF Library. A library with support for reading and * writing all EXIF headers of JPEG images using PHP. * * Copyright (C) 2004 Martin Geisler <gim...@us...> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program in the file COPYING; if not, write to the [...1130 lines suppressed...] case self::SHARPNESS: return('This tag indicates the direction of sharpness processing ' . 'applied by the camera when the image was shot.'); case self::DEVICE_SETTING_DESCRIPTION: return('This tag indicates information on the picture-taking ' . 'conditions of a particular camera model. The tag is used ' . 'only to indicate the picture-taking conditions in the ' . 'reader.'); case self::SUBJECT_DISTANCE_RANGE: return('This tag indicates the distance to the subject.'); case self::IMAGE_UNIQUE_ID: return('This tag indicates an identifier assigned uniquely to ' . 'each image. It is recorded as an ASCII string equivalent ' . 'to hexadecimal notation and 128-bit fixed length.'); default: return sprintf('Unknown Tag: 0x%X', $tag); } } } ?> --- NEW FILE: TODO --- TODO file for PEL: PHP EXIF Library. A library with support for reading and writing all EXIF headers of JPEG images using PHP. Copyright (C) 2004 Martin Geisler <gim...@us...> Licensed under the GNU GPL, see COPYING for details. -------------------- TODO list for PEL ======================== In addition to the following list, then the source contains a number of comments beginning with 'TODO' which marks extra places where attention is needed. * Look at using Gettext or some other tool for I18n. * Document all files, classes, and methods. * Write code for doing automated tests. --- NEW FILE: INSTALL --- INSTALL file for PEL: PHP EXIF Library. A library with support for reading and writing all EXIF headers of JPEG images using PHP. Copyright (C) 2004 Martin Geisler <gim...@us...> Licensed under the GNU GPL, see COPYING for details. -------------------- Requirements ======================== PEL requires PHP 5. The world is still waiting for the final release of this version, but in the mean time the release candidates should be used. PEL was developed with PHP 5 Release Candidate 2. -------------------- Installation ======================== PEL is installed by downloading it and unpacking it in a directory of your choice. Your application can then start using the classed defined in PEL, most likely the PelJpegData class which contain an entire JPEG image. -------------------- Usage ======================== Your application should include at least the PelDataWindow.php file for the definition of the basic PelDataWindow class which is used to stored data in. The PelJpegData class is also needed if PEL should do the parsing of JPEG data for you. This example will load a JPEG file given as a command line argument, parse the EXIF data within, change the comment to 'Edited by PEL', and finally save the file again. <?php include_once('PelJpegData.php'); include_once('PelDataWindow.php'); $data = new PelDataWindow(file_get_contents($argv[1])); $jpeg = new PelJpegData($data); $ifd0 = $jpeg->getSection(2)->getContent()->getIfd(); $entry = $ifd0->getEntry(PelExifTag::IMAGE_DESCRIPTION); $entry->setAscii('Edited by PEL'); file_put_contents($argv[1], $jpeg->getBytes()); ?> See the test directory for this example and others as PHP files. You may have to adjust the path found in the very first line of the files before you can execute them. --- NEW FILE: PelExifEntryRational.php --- <?php /* PEL: PHP EXIF Library. A library with support for reading and * writing all EXIF headers of JPEG images using PHP. * * Copyright (C) 2004 Martin Geisler <gim...@us...> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program in the file COPYING; if not, write to the * Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307 USA */ /* $Id: PelExifEntryRational.php,v 1.1 2004/05/07 15:13:21 gimpster Exp $ */ /** * Classes used to manipulate rational numbers. * * @author Martin Geisler <gim...@us...> * @version $Revision: 1.1 $ * @license http://www.gnu.org/licenses/gpl.html GNU General Public * License (GPL) * @package PEL * @subpackage EXIF */ /** Class definition of {@link PelException}. */ include_once('PelException.php'); /** Class definition of {@link PelExifEntryLong}. */ include_once('PelExifEntryLong.php'); /** * Class for holding signed rational numbers. * * This class can hold rational numbers, consisting of a enumerator * and denumerator both of which are of type long. The class can hold * either just a single rational or an array of rationals. The class * will be used to manipulate any of the EXIF tags which can have * format {@link PelExifFormat::RATIONAL} like in this example: * * <code> * $resolution = $ifd->getEntry(PelExifTag::X_RESOLUTION); * $resolution->setRational(1, 300); * </code> * * Here the x-resolution is adjusted to 1/300, which will be 300 DPI, * unless the {@link PelExifTag::RESOLUTION_UNIT resolution unit} is * set to something different than 2 which means inches. * * @todo distinguish between signed and unsigned rationals. * * @author Martin Geisler <gim...@us...> * @package PEL * @subpackage EXIF */ class PelExifEntryRational extends PelExifEntryLong { /** * Make a new entry that can hold a rational. * * The {@link getLong} method will always return an array of * two-element arrays. * * @param PelExifTag the tag which this entry represents. This * should be one of the constants defined in {@link PelExifTag}, * e.g., {@link PelExifTag::IMAGE_WIDTH}, or any other tag which can * have format {@link PelExifFormat::LONG}. * * @param long|array $value the long(s) that this entry will * represent or an array of longs. The argument passed must obey * the same rules as the argument to {@link setLong}, namely that it * should be within range of a signed long (32 bit), that is between * -2147483648 and 2147483647 (inclusive). If not, then a {@link * PelExifEntryShortException} will be thrown. */ function __construct($tag) { $this->tag = $tag; $this->format = PelExifFormat::RATIONAL; $this->dimension = 2; $this->min = 0; $this->max = 4294967295; } function formatNumber($number, $brief = false) { return $number[0] . '/' . $number[1]; } /** * Get the value of an entry as text. * * The value will be returned in a format suitable for presentation, * e.g., rationals will be returned as 'x/y', ASCII strings will be * returned as themselves etc. * * @param boolean some values can be returned in a long or more * brief form, and this parameter controls that. * * @return string the value as text. */ function getText($brief = false) { if (isset($this->numbers[0])) $v = $this->numbers[0]; switch ($this->tag) { case PelExifTag::FNUMBER: //CC (e->components, 1, v); return sprintf('f/%.01f', $v[0]/$v[1]); case PelExifTag::APERTURE_VALUE: //CC (e->components, 1, v); //if (!v_rat.denominator) return (NULL); return sprintf('f/%.01f', pow(2, $v[0]/$v[1]/2)); case PelExifTag::FOCAL_LENGTH: //CC (e->components, 1, v); //if (!v_rat.denominator) return (NULL); return sprintf('%.1f mm', $v[0]/$v[1]); case PelExifTag::SUBJECT_DISTANCE: //CC (e->components, 1, v); //if (!v_rat.denominator) return (NULL); return sprintf('%.1f m', $v[0]/$v[1]); case PelExifTag::EXPOSURE_TIME: //CC (e->components, 1, v); //if (!v_rat.denominator) return (NULL); if ($v[0]/$v[1] < 1) return sprintf('1/%d sec.', $v[1]/$v[0]); else return sprintf('%d sec.', $v[0]/$v[1]); default: return parent::getText($brief); } } } class PelExifEntrySRational extends PelExifEntrySLong { function __construct($tag) { $this->tag = $tag; $this->format = PelExifFormat::SRATIONAL; $this->dimension = 2; $this->min = -2147483648; $this->max = 2147483647; } function formatNumber($number, $brief = false) { if ($number[1] < 0) /* Turn output like 1/-2 into -1/2. */ return (-$number[0]) . '/' . (-$number[1]); else return $number[0] . '/' . $number[1]; } /** * Get the value of an entry as text. * * The value will be returned in a format suitable for presentation, * e.g., rationals will be returned as 'x/y', ASCII strings will be * returned as themselves etc. * * @param boolean some values can be returned in a long or more * brief form, and this parameter controls that. * * @return string the value as text. */ function getText($brief = false) { if (isset($this->numbers[0])) $v = $this->numbers[0]; switch ($this->tag) { case PelExifTag::SHUTTER_SPEED_VALUE: //CC (e->components, 1, v); //if (!v_srat.denominator) return (NULL); return sprintf('%.0f/%.0f sec. (APEX: %d)', $v[0], $v[1], pow(sqrt(2), $v[0]/$v[1])); case PelExifTag::BRIGHTNESS_VALUE: //CC (e->components, 1, v); // // TODO: figure out the APEX thing, or remove this so that it's // handled by the default clause at the bottom. return sprintf('%d/%d', $v[0], $v[1]); //FIXME: How do I calculate the APEX value? case PelExifTag::EXPOSURE_BIAS_VALUE: //CC (e->components, 1, v); // TODO: is getRational as good as getSRational? //if (!v_srat.denominator) return (NULL); return sprintf('%s%.01f', $v[0]*$v[1] > 0 ? '+' : '', $v[0]/$v[1]); default: parent::getText($brief); } } } ?> --- NEW FILE: PelConvert.php --- <?php /* PEL: PHP EXIF Library. A library with support for reading and * writing all EXIF headers of JPEG images using PHP. * * Copyright (C) 2004 Martin Geisler <gim...@us...> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program in the file COPYING; if not, write to the * Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307 USA */ /* $Id: PelConvert.php,v 1.1 2004/05/07 15:13:21 gimpster Exp $ */ /** * * * @author Martin Geisler <gim...@us...> * @version $Revision: 1.1 $ * @license http://www.gnu.org/licenses/gpl.html GNU General Public * License (GPL) * @package PEL */ /** * Conversion functions to and from bytes and integers. * * The functions found in this class are used to convert bytes into * integers of several sizes ({@ling bytesToShort}, {@link * bytesToLong}, and {@link bytesToRational}) and convert integers of * several sizes into bytes ({@link shortToBytes}, {@link * longToBytes}, and {@link rationalToBytes}). * * All the methods are static and they all rely on an argument that * specifies the byte order to be used, this must be one of the class * constants {@link LITTLE_ENDIAN} or {@link BIG_ENDIAN}. These * constants will be referred to as the pseudo type PelByteOrder * throughout the documentation. * * @author Martin Geisler <gim...@us...> * @package PEL */ class PelConvert { /** * Little-endian byte order. * * Data stored in little-endian byte order store the least * significant byte fist, so the number 0x12345678 becomes 0x78 0x56 * 0x34 0x12 when stored with little-endian byte order. */ const LITTLE_ENDIAN = true; /** * Big-endian byte order. * * Data stored in big-endian byte order store the most significant * byte fist, so the number 0x12345678 becomes 0x12 0x34 0x56 0x78 * when stored with big-endian byte order. */ const BIG_ENDIAN = false; /** * Convert a short into two bytes. * * @param int the short that will be converted. The lower two bytes * will be extracted regardless of the actual size passed. * * @param PelByteOrder one of {@link LITTLE_ENDIAN} and {@link * BIG_ENDIAN}. */ static function shortToBytes($value, $endian) { if ($endian == self::LITTLE_ENDIAN) return chr($value) . chr($value >> 8); else return chr($value >> 8) . chr($value); } static function longToBytes($value, $endian) { if ($endian == self::LITTLE_ENDIAN) return (chr($value) . chr($value >> 8) . chr($value >> 16) . chr($value >> 24)); else return (chr($value >> 24) . chr($value >> 16) . chr($value >> 8) . chr($value)); } static function bytesToLong(&$bytes, $offset, $endian) { if ($endian == self::LITTLE_ENDIAN) return (ord($bytes{$offset+3}) << 24 | ord($bytes{$offset+2}) << 16 | ord($bytes{$offset+1}) << 8 | ord($bytes{$offset})); else return (ord($bytes{$offset}) << 24 | ord($bytes{$offset+1}) << 16 | ord($bytes{$offset+2}) << 8 | ord($bytes{$offset+3})); } static function bytesToShort(&$bytes, $offset, $endian) { if ($endian == self::LITTLE_ENDIAN) return (ord($bytes{$offset+1}) << 8 | ord($bytes{$offset})); else return (ord($bytes{$offset}) << 8 | ord($bytes{$offset+1})); } static function bytesToRational(&$bytes, $offset, $endian) { return array(self::bytesToLong($bytes, $offset, $endian), self::bytesToLong($bytes, $offset+4, $endian)); } static function bytesToSRational(&$bytes, $offset, $endian) { return array(self::bytesToLong($bytes, $offset, $endian), self::bytesToLong($bytes, $offset+4, $endian)); } static function bytesToDump($bytes, $max = 0) { $s = strlen($bytes); if ($max > 0) $s = min($max, $s); $line = 24; for ($i = 0; $i < $s; $i++) { printf('%02X ', ord($bytes{$i})); if (($i+1) % $line == 0) print("\n"); } print("\n"); } } ?> --- NEW FILE: PelJpegData.php --- <?php /* PEL: PHP EXIF Library. A library with support for reading and * writing all EXIF headers of JPEG images using PHP. * * Copyright (C) 2004 Martin Geisler <gim...@us...> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program in the file COPYING; if not, write to the * Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307 USA */ /* $Id: PelJpegData.php,v 1.1 2004/05/07 15:13:21 gimpster Exp $ */ /** * @author Martin Geisler <gim...@us...> * @version $Revision: 1.1 $ * @license http://www.gnu.org/licenses/gpl.html GNU General Public License (GPL) * @package PEL */ /** Class definition of {@link PelException}. */ include_once('PelException.php'); /** Class definition of {@link PelJpegMarker}. */ include_once('PelJpegMarker.php'); /** Class definition of {@link PelJpegContent}. */ include_once('PelJpegContent.php'); /** Class definition of {@link PelJpegSection}. */ include_once('PelJpegSection.php'); /** Class definition of {@link PelExifData}. */ include_once('PelExifData.php'); /** * @author Martin Geisler <gim...@us...> * @package PEL * @subpackage JPEG */ class PelJpegDataException extends PelException {} /** * @author Martin Geisler <gim...@us...> * @package PEL * @subpackage JPEG */ class PelJpegData { private $count = 0; private $sections = array(); /* Just JPEG image data */ private $jpeg_data = null; function __construct(PelDataWindow $d) { //println('Parsing ' . $d->getSize() . ' bytes...'); /* JPEG data is stored in little-endian format. */ $d->setByteOrder(PelConvert::BIG_ENDIAN); /* Run through the data to read the sections in the image. After * each section is read, the start of the data window will be * moved forward, and after the last section we'll terminate with * no data left in the window. */ while ($d->getSize() > 0) { /* JPEG sections start with 0xFF. The first byte that is not * 0xFF is a marker (hopefully). */ for ($i = 0; $i < 7; $i++) if ($d->getByte($i) != 0xFF) break; $marker = $d->getByte($i); if (!PelJpegMarker::isValidMarker($marker)) throw new PelJpegDataException('Invalid marker: 0x%02X at offset %d', $marker, $i); // println('Found marker 0x%X %s offset %d', // $marker, PelJpegMarker::getName($marker), $i); /* Move window so first byte becomes first byte in this * section. */ $d->setWindowStart($i+1); if ($marker == PelJpegMarker::SOI || $marker == PelJpegMarker::EOI) { $content = new PelJpegContent(new PelDataWindow()); $section = new PelJpegSection($marker, $content); self::appendSection($section); } else { /* Read the length of the section. The length includes the * two bytes used to store the length. */ $len = $d->getShort(0) - 2; // println('Found %s section of length %d', PelJpegMarker::getName($marker), $len); /* Skip past the length. */ $d->setWindowStart(2); if ($marker == PelJpegMarker::APP1) { $content = new PelExifData($d->getClone(0, $len)); $section = new PelJpegSection($marker, $content); self::appendSection($section); } else { $content = new PelJpegContent($d->getClone(0, $len)); $section = new PelJpegSection($marker, $content); self::appendSection($section); /* In case of SOS, image data will follow. */ if ($marker == PelJpegMarker::SOS) { $this->jpeg_data = $d->getClone($len, -2); //println('JPEG data: ' . $this->jpeg_data->__toString()); /* Skip past the JPEG data. */ $d->setWindowStart($this->jpeg_data->getSize()); } } /* Skip past the data from the last marker. */ $d->setWindowStart($len); } } } function appendSection(PelJpegSection $s) { $this->sections[] = $s; $this->count++; } function getSection($i) { return $this->sections[$i]; } function getSections() { return $this->sections; } function getBytes() { $bytes = ''; for ($i = 0; $i < $this->count; $i++) { $s = $this->sections[$i]; $m = $s->getMarker(); //printf ("Writing marker 0x%X...\n", $m); /* Write the marker */ $bytes .= "\xFF" . PelJpegMarker::getBytes($m); if ($m == PelJpegMarker::SOI || $m == PelJpegMarker::EOI) continue; $data = $s->getContent()->getBytes(); $size = strlen($data); $bytes .= chr(($size + 2) >> 8); $bytes .= chr($size + 2); $bytes .= $data; /* In case of SOS, we need to write the JPEG data. */ if ($m == PelJpegMarker::SOS) $bytes .= $this->jpeg_data->getBytes(); } return $bytes; } function __toString() { $str = "Dumping JPEG data...\n"; for ($i = 0; $i < $this->count; $i++) { $m = $this->sections[$i]->getMarker(); $c = $this->sections[$i]->getContent(); $str .= sprintf("Section %d (marker 0x%X - %s):\n", $i, $m, PelJpegMarker::getName($m)); $str .= sprintf(" Description: %s\n", PelJpegMarker::getDescription($m)); if ($m == PelJpegMarker::SOI || $m == PelJpegMarker::EOI) continue; if ($m == PelJpegMarker::APP1) { $str .= $c->__toString() . "\n"; } else { $str .= sprintf(" Size: %d\n", $c->getSize()); $str .= sprintf(" Unknown content.\n"); } } return $str; } } ?> --- NEW FILE: PelJpegSection.php --- <?php /* PEL: PHP EXIF Library. A library with support for reading and * writing all EXIF headers of JPEG images using PHP. * * Copyright (C) 2004 Martin Geisler <gim...@us...> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program in the file COPYING; if not, write to the * Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307 USA */ /* $Id: PelJpegSection.php,v 1.1 2004/05/07 15:13:21 gimpster Exp $ */ /** * Class representing a JPEG section. * * @author Martin Geisler <gim...@us...> * @version $Revision: 1.1 $ * @license http://www.gnu.org/licenses/gpl.html GNU General Public * License (GPL) * @package PEL * @subpackage JPEG */ /** Class definition of {@link PelJpegMarker}. */ include_once('PelJpegMarker.php'); /** Class definition of {@link PelJpegContent}. */ include_once('PelJpegContent.php'); /** * Class representing a JPEG section. * * Each section in a JPEG file has a {@link PelJpegMarker JPEG marker} * and some JPEG content. The content can be either generic {@link * PelJpegContent JPEG content} or {@link PelExifData EXIF data}. * This class is simply a pair of a {@link PelJpegMarker} and a {@link * PelJpegContent}, where the latter could be an {@link PelExifData} * object instead. * * @author Martin Geisler <gim...@us...> * @package PEL * @subpackage JPEG */ class PelJpegSection { private $marker = null; private $content = null; function __construct($m, PelJpegContent $c) { $this->marker = $m; $this->content = $c; } function getMarker() { return $this->marker; } function getContent() { return $this->content; } } ?> --- NEW FILE: PelExifEntryAscii.php --- <?php /* PEL: PHP EXIF Library. A library with support for reading and * writing all EXIF headers of JPEG images using PHP. * * Copyright (C) 2004 Martin Geisler <gim...@us...> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program in the file COPYING; if not, write to the * Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307 USA */ /* $Id: PelExifEntryAscii.php,v 1.1 2004/05/07 15:13:21 gimpster Exp $ */ /** * Classes used to hold ASCII strings. * * The classes defined here are to be used for EXIF entries holding * ASCII strings, such as {@link PelExifTag::MAKE}, {@link * PelExifTag::SOFTWARE}, and {@link PelExifTag::DATE_TIME}. For * entries holding normal textual ASCII strings the class {@link * PelExifEntryAscii} should be used, but for entries holding * timestamps the class {@link PelExifEntryTime} would be more * convenient instead. Copyright information is handled by the {@link * PelExifEntryCopyright} class. * * @author Martin Geisler <gim...@us...> * @version $Revision: 1.1 $ * @license http://www.gnu.org/licenses/gpl.html GNU General Public * License (GPL) * @package PEL * @subpackage EXIF */ /** Class definition of {@link PelExifEntry}. */ include_once('PelExifEntry.php'); /** * Class for holding a plain ASCII string. * * This class can hold a single ASCII string, and it will be used as in * <code> * $entry = $ifd->getEntry(PelExifTag::IMAGE_DESCRIPTION); * print($entry->getAscii()); * $entry->setAscii('This is my image. I like it.'); * </code> * * @author Martin Geisler <gim...@us...> * @package PEL * @subpackage EXIF */ class PelExifEntryAscii extends PelExifEntry { /** * The string hold by this entry. * * This is the string that was given to the {@link __construct * constructor} or later to {@link setAscii}, without any final NULL * character. * * @var string */ private $str; /** * Make a new PelExifEntry that can hold an ASCII string. * * @param int the tag which this entry represents. This should be * one of the constants defined in {@link PelExifTag}, e.g., {@link * PelExifTag::IMAGE_DESCRIPTION}, {@link PelExifTag::MODEL}, or any other * tag with format {@link PelExifFormat::ASCII}. * * @param string the string that this entry will represent. The * string must obey the same rules as the string argument to {@link * setAscii}, namely that it should be given without any trailing * NULL character and that it must be plain 7-bit ASCII. */ function __construct($tag, $str = '') { $this->tag = $tag; $this->format = PelExifFormat::ASCII; $this->setAscii($str); } /** * Give the entry a new ASCII value. * * This will overwrite the previous value. The value can be * retrieved later with the {@link getAscii} method. * * @param string the new value of the entry. This should be given * without any trailing NULL character. The string must be plain * 7-bit ASCII, the string should contain no high bytes. */ function setAscii($str) { // TODO: check that we always use a NULL character to terminate // ASCII strings. // TODO: check for ASCII string. $this->components = strlen($str)+1; $this->str = $str; $this->bytes = $str . chr(0); } /** * Return the ASCII string of the entry. * * @return string the string held, without any final NULL character. * The string will be the same as the one given to {@link setAscii} * or to the {@link __construct constructor}. */ function getAscii() { return $this->str; } /** * Return the ASCII string of the entry. * * This methods returns the same as {@link getAscii}. * * @param boolean not used with ASCII entries. * * @return string the string held, without any final NULL character. * The string will be the same as the one given to {@link setAscii} * or to the {@link __construct constructor}. */ function getText($brief = false) { return $this->str; } } /** * Class for holding a UNIX timestamp. * * This class can hold a single UNIX timestamp, and it will be used as * in this example where the time is advanced by one week: * <code> * $entry = $ifd->getEntry(ExifTag::DATE_TIME_ORIGINAL); * $time = $entry->getTime(); * print('The image was taken on the ' . date($time, 'jS')); * $entry->setTime($time + 7 * 24 * 3600); * </code> * * @author Martin Geisler <gim...@us...> * @package PEL * @subpackage EXIF */ class PelExifEntryTime extends PelExifEntryAscii { /** * The UNIX timestamp held by this entry. * * @var int */ private $timestamp; /** * Make a new entry for holding a timestamp. * * @param int the EXIF tag which this entry represents. There are * only three standard tags which hold timestamp, so this should be * one of the constants {@link PelExifTag::DATE_TIME}, {@link * PelExifTag::DATE_TIME_ORIGINAL}, or {@link * PelExifTag::DATE_TIME_DIGITIZED}. * * @param int the UNIX timestamp held by this entry. */ function __construct($tag, $timestamp = false) { if (!is_int($timestamp)) $timestamp = time(); // TODO: use gmdate() instead, or how to deal with timezones? Use // the TimeZoneOffset tag 0x882A? parent::__construct($tag); $this->setTime($timestamp); } /** * Return the UNIX timestamp of the entry. * * @return int the timestamp held. This will be a standard UNIX * timestamp (counting the number of seconds since 00:00:00 January * 1st, 1970 UTC). This will be the same as the one given to {@link * setTime} or to the {@link __construct constructor}. */ function getTime() { return $this->timestamp; } /** * Update the UNIX timestamp held by this entry. * * @param int the new timestamp to be held by this entry. This * should be a standard UNIX timestamp (counting the number of * seconds since 00:00:00 January 1st, 1970 UTC). The old timestamp * will be overwritten, retrive it first with {@link getTime} if * necessary. */ function setTime($timestamp) { $this->timestamp = $timestamp; $this->setAscii(date('Y:m:d H:i:s', $timestamp)); } } /** * Class for holding copyright information. * * The EXIF standard speficies a certain format for copyright * information where the one {@link PelExifTag::COPYRIGHT copyright * tag} holds both the photographer and editor copyrights, separated * by a NULL character. * * This class is used to manipulate that tag so that the format is * kept to the standard. A common use would be to add a new copyright * tag to an image, since most cameras don't add this tag themselves. * This would be done like this: * * <code> * $entry = new PelExifEntryCopyright('Copyright, Martin Geisler, 2004'); * $ifd0->addEntry($entry); * </code> * * Here we only set the photographer copyright, use the optional * second argument to specify the editor copyright. If there's only * an editor copyright, then let the first argument be the empty * string. * * @author Martin Geisler <gim...@us...> * @package PEL * @subpackage EXIF */ class PelExifEntryCopyright extends PelExifEntryAscii { /** * The photographer copyright. * * @var string */ private $photographer; /** * The editor copyright. * * @var string */ private $editor; /** * Make a new entry for holding copyright information. * * @param string the photographer copyright. Use the empty string * if there's no photographer copyright. * * @param string the editor copyright. Use the empty string if * there's no editor copyright. */ function __construct($photographer = '', $editor = '') { parent::__construct(PelExifTag::COPYRIGHT); $this->setCopyright($photographer, $editor); } /** * Update the copyright information. * * @param string the photographer copyright. Use the empty string * if there's no photographer copyright. * * @param string the editor copyright. Use the empty string if * there's no editor copyright. */ function setCopyright($photographer = '', $editor = '') { $this->photographer = $photographer; $this->editor = $editor; if ($photographer == '' && $editor != '') $photographer = ' '; if ($editor == '') $this->setAscii($photographer); else $this->setAscii($photographer . chr(0x00) . $editor); } /** * Retrive the copyright information. * * The strings returned will be the same as the one used previously * with either {@link __construct the constructor} or with {@link * setCopyright}. * * @return array an array with two strings, the photographer and * editor copyrights. The two fields will be returned in that * order, so that the first array index will be the photographer * copyright, and the second will be the editor copyright. */ function getCopyright() { return array($this->photographer, $this->editor); } /** * Return a text string with the copyright information. * * The photographer and editor copyright fields will be returned * with a '-' inbetween if both copyright fields are present, * otherwise only one of them will be returned. * * @param boolean if false, then the strings '(Photographer)' and * '(Editor)' will be appended to the photographer and editor * copyright fields (if present), otherwise the fields will be * returned as is. * * @return string the copyright information in a string. */ function getText($brief = false) { if ($brief) { $p = ''; $e = ''; } else { $p = ' (Photographer)'; $e = ' (Editor)'; } if ($this->photographer != '' && $this->editor != '') return $this->photographer . $p . ' - ' . $this->editor . $e; if ($this->photographer != '') return $this->photographer . $p; if ($this->editor != '') return $this->editor . $e; return ''; } } ?> --- NEW FILE: PelExifData.php --- <?php /* PEL: PHP EXIF Library. A library with support for reading and * writing all EXIF headers of JPEG images using PHP. * * Copyright (C) 2004 Martin Geisler <gim...@us...> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program in the file COPYING; if not, write to the * Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307 USA */ /* $Id: PelExifData.php,v 1.1 2004/05/07 15:13:21 gimpster Exp $ */ /** * Classes for dealing with EXIF data. * * @author Martin Geisler <gim...@us...> * @version $Revision: 1.1 $ * @license http://www.gnu.org/licenses/gpl.html GNU General Public * License (GPL) * @package PEL * @subpackage EXIF */ /** Class definition of {@link PelException}. */ include_once('PelException.php'); /** Class definition of {@link PelJpegContent}. */ include_once('PelJpegContent.php'); /** Class definition of {@link PelExifIfd}. */ include_once('PelExifIfd.php'); /** Class definition of {@link PelExifTag}. */ include_once('PelExifTag.php'); /** Class definition of {@link PelExifEntry}. */ include_once('PelExifEntry.php'); /** Class definition of {@link PelExifFormat}. */ include_once('PelExifFormat.php'); /** * Exception throw if invalid EXIF data is found. * * @author Martin Geisler <gim...@us...> * @package PEL * @subpackage EXIF */ class PelExifDataException extends PelException {} /** * Class representing EXIF data. * * EXIF data resides as {@link PelJpegData data} in a {@link * PelJpegSection JPEG section} and consists of a header followed by a * number of {@link PelJpegIfd IFDs}. * * @author Martin Geisler <gim...@us...> * @package PEL * @subpackage EXIF */ class PelExifData extends PelJpegContent { /** * EXIF header. * * The EXIF data must start with these six bytes to be considered * valid. */ const EXIF_HEADER = "Exif\0\0"; /** * TIFF header. * * Following the {@link EXIF_HEADER EXIF header} and the two bytes * indicating the byte order, one must find this value. */ const TIFF_HEADER = 0x002A; /* The first PelExifIfd, if any */ private $ifd = null; private $size = 0; private $order = PelConvert::LITTLE_ENDIAN; function __construct(PelDataWindow $d) { //printf("Parsing %d bytes of EXIF data...\n", $d->getSize()); $this->size = $d->getSize(); if ($d->getSize() < 6) throw new PelExifDataException('Not enough data to be valid EXIF data.'); // if ($d->strcmp(0, self::EXIF_HEADER)) { // printf ("Found EXIF header.\n"); // } else { // while (true) { // while ((ord($d{0}) == 0xFF) && $size > 0) { // $d = substr($d, 1); // $size--; // } // /* JPEG_MARKER_SOI */ // if (ord($d{0}) == PelJpegMarker::SOI) { // printf("Found PelJpegMarker::SOI\n"); // $d = substr($d, 1); // $size--; // continue; // } // /* JPEG_MARKER_APP0 */ // if (ord($d{0}) == PelJpegMarker::APP0) { // printf("Found PelJpegMarker::APP0\n"); // $d = substr($d, 1); // $size--; // $l = ($d{0} << 8) | $d{1}; // if ($l > $size) // throw new PelExifDataException('Invalid length: ' . $l . ' > ' . $size); // $d = substr($d, $l); // $size -= $l; // continue; // } // /* JPEG_MARKER_APP1 */ // if (ord($d{0}) == PelJpegMarker::APP1) { // printf("Found PelJpegMarker::APP1\n"); // break; // } // /* Unknown marker or data. Give up. */ // throw new PelExifDataException('EXIF marker not found.'); // } // $d->setWindowStart(1); // $d = substr($d, 1); // $size--; // if ($size < 2) { // throw new PelExifDataException('Size too small.'); // } // $len = (ord($d{0}) << 8) | ord($d{1}); // printf ("We have to deal with %d bytes of EXIF data.\n", $len); // $d = substr($d, 2); // $size -= 2; // throw new PelExifDataException('EXIF marker not found.'); // } /* Verify the EXIF header */ if ($d->getSize() < 6) throw new PelExifDataException('Not enough data to be valid EXIF data.'); if ($d->strcmp(0, self::EXIF_HEADER)) { //printf ("Found EXIF header.\n"); } else { throw new PelExifDataException('EXIF header not found.'); } /* Byte order */ // TODO: redundant check?! if ($d->getSize() < 12) throw new PelExifDataException('Size too small'); if ($d->strcmp(6, 'II')) { $d->setByteOrder(PelConvert::LITTLE_ENDIAN); $this->order = PelConvert::LITTLE_ENDIAN; //printf("Found Intel byte order\n"); } elseif ($d->strcmp(6, 'MM')) { $d->setByteOrder(PelConvert::BIG_ENDIAN); $this->order = PelConvert::LITTLE_ENDIAN; //printf("Found Motorola byte order\n"); } else { throw new PelExifDataException('Unknown byte order: 0x%X 0x%X', $d->getByte(6), $d->getByte(7)); } /* Fixed value */ if ($d->getShort(8) != self::TIFF_HEADER) throw new PelExifDataException('Wrong fixed value, should TIFF 42?'); /* IFD 0 offset */ $offset = $d->getLong(10); //printf ("IFD 0 at %d.\n", $offset); /* Parse the actual exif data, the Ifd needs to know it's own * offset within the APP1 marker so that it can calculate proper * offsets to other Ifds. */ /* The offset counts from the beginning of the TIFF header, which * itself starts with the 'II' or 'MM' at byte 6. */ $this->ifd = new PelExifIfd($d->getClone(6), $offset); } function getSize() { return $this->size; } function getIfd() { return $this->ifd; } function getBytes() { $bytes = self::EXIF_HEADER; if ($this->order == PelConvert::LITTLE_ENDIAN) $bytes .= 'II'; else $bytes .= 'MM'; /* TIFF magic number --- fixed value. */ $bytes .= PelConvert::shortToBytes(0x002A, $this->order); /* * IFD 0 offset. We will always start IDF 0 after the EXIF header * at an offset of 8 bytes (2 bytes for byte order, another 2 * bytes for the TIFF header, and 4 bytes for the IFD 0 offset * make 8 bytes together). */ $bytes .= PelConvert::longToBytes(8, $this->order); /* Now save IFD 0. IFD 1 will be saved automatically. */ //printf ("Saving IFDs...\n"); /* The argument specifies the offset within the EXIF data of this * IFD. The IFD will use this to calculate offsets from the EXIF * entries to their data, all those offsets are absolute offsets * counted from the beginning of the EXIF data. */ $bytes .= $this->ifd->getBytes(8, $this->order); return $bytes; } function __toString() { $str = ''; if ($this->ifd != null) $str .= $this->ifd->__toString(); return $str; } } ?> --- NEW FILE: README --- README file for PEL: PHP EXIF Library. A library with support for reading and writing all EXIF headers of JPEG images using PHP. Copyright (C) 2004 Martin Geisler <gim...@us...> Licensed under the GNU GPL, see COPYING for details. -------------------- Description ======================== PEL lets you read and write EXIF headers found in JPEG images easily. See the file INSTALL for an introduction to how PEL can be used by other applications. -------------------- Features ======================== * Supports reading and writing all tags supported by the C libexif (http://sf.net/projects/libexif) library. * Extensible object-oriented design. -------------------- Credits ======================== PEL started out as a port of libexif (http://sf.net/projects/libexif) from C to PHP. --- NEW FILE: PelExifEntryNumber.php --- <?php /* PEL: PHP EXIF Library. A library with support for reading and * writing all EXIF headers of JPEG images using PHP. * * Copyright (C) 2004 Martin Geisler <gim...@us...> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program in the file COPYING; if not, write to the * Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307 USA */ /* $Id: PelExifEntryNumber.php,v 1.1 2004/05/07 15:13:21 gimpster Exp $ */ /** * Abstract class for numbers. * * @author Martin Geisler <gim...@us...> * @version $Revision: 1.1 $ * @license http://www.gnu.org/licenses/gpl.html GNU General Public * License (GPL) * @package PEL * @subpackage EXIF */ /** Class definition of {@link PelException}. */ include_once('PelException.php'); /** Class definiti... [truncated message content] |
From: Martin G. <gim...@us...> - 2004-05-07 15:06:30
|
Update of /cvsroot/pel/pel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20079 Added Files: COPYING Log Message: PEL is licensed under the GNU GPL. --- NEW FILE: COPYING --- GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it does.> Copyright (C) <year> <name of author> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. <signature of Ty Coon>, 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. |