cvs: pear /Image_IPTC IPTC.php

From: Date: Thu, 01 Mar 2007 22:50:09 +0000
Subject: cvs: pear /Image_IPTC IPTC.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-44930@lists.php.net to get a copy of this message
polone Thu Mar 1 22:50:09 2007 UTC Modified files: /pear/Image_IPTC IPTC.php Log: Updated comments to latest PEAR standard. http://cvs.php.net/viewvc.cgi/pear/Image_IPTC/IPTC.php?r1=1.5&r2=1.6&diff_format=u Index: pear/Image_IPTC/IPTC.php diff -u pear/Image_IPTC/IPTC.php:1.5 pear/Image_IPTC/IPTC.php:1.6 --- pear/Image_IPTC/IPTC.php:1.5 Tue Aug 12 14:15:55 2003 +++ pear/Image_IPTC/IPTC.php Thu Mar 1 22:50:09 2007 @@ -1,22 +1,27 @@ <?php -/* vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4: */ -// +----------------------------------------------------------------------+ -// | PHP version 4 | -// +----------------------------------------------------------------------+ -// | Copyright (c) 2003-2004 TownNews.com | -// +----------------------------------------------------------------------+ -// | This source file is subject to version 2.0 of the PHP license, | -// | that is bundled with this package in the file LICENSE, and is | -// | available at through the world-wide-web at | -// | http://www.php.net/license/2_02.txt. | -// | If you did not receive a copy of the PHP license and are unable to | -// | obtain it through the world-wide-web, please send a note to | -// | license@php.net so we can mail you a copy immediately. | -// +----------------------------------------------------------------------+ -// | Authors: Patrick O'Lone <polone@townnews.com> | -// +----------------------------------------------------------------------+ -// -// $Id: IPTC.php,v 1.5 2003/08/12 14:15:55 polone Exp $ + +/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ + +/** + * Photo IPTC interface + * + * PHP versions 4 and 5 + * + * LICENSE: This source file is subject to version 3.0 of the PHP license + * that is available through the world-wide-web at the following URI: + * http://www.php.net/license/3_0.txt. If you did not receive a copy of + * the PHP License and are unable to obtain it through the web, please + * send a note to license@php.net so we can mail you a copy immediately. + * + * @category Image + * @package Image_IPTC + * @author Patrick O'Lone <polone@townnews.com> + * @copyright 1997-2005 The PHP Group + * @license http://www.php.net/license/3_0.txt PHP License 3.0 + * @version CVS: NITF.php,v 1.9 2005/03/21 18:07:19 polone Exp + * @link http://pear.php.net/package/Image_IPTC/ + */ + /** * An abstraction layer for working with IPTC fields @@ -27,10 +32,12 @@ * * @author Patrick O'Lone <polone@townnews.com> * @copyright 2003-2004 TownNews.com -* @version $Revision: 1.5 $ +* @version $Revision: 1.6 $ */ class Image_IPTC { + // {{{ Properties + /** * @var string * The name of the image file that contains the IPTC fields to extract and @@ -57,6 +64,9 @@ * @access private */ var $_bIPTCParse = false; + + // }}} + // {{{ Image_IPTC() /** * Constructor @@ -72,7 +82,7 @@ if (is_file($this->_sFilename)) { - if (@getimagesize($this->_sFilename, $aAPP) && !empty($aAPP)) { + if (@getimagesize($this->_sFilename, $aAPP) && !empty($aAPP['APP13'])) { $this->_aIPTC = @iptcparse($aAPP['APP13']); $this->_bIPTCParse = true; @@ -82,6 +92,9 @@ } } + + // }}} + // {{{ isValid() /** * Returns the status of IPTC parsing during instantiation @@ -99,26 +112,18 @@ { return $this->_bIPTCParse; } + + // }}} + // {{{ setTag() /** - * Set IPTC fields to a specific value or values - * - * @param mixed - * The field (by number or string) of the IPTC data you wish to update - * - * @param mixed - * If the value supplied is scalar, then the block assigned will be set to - * the given value. If the value supplied is an array, then the entire tag - * will be given the value of the array. - * - * @param integer - * The block to update. Most tags only use the 0th block, but certain tags, - * like the "keywords" tag, use a list of values. If set to a negative - * value, the entire tag block will be replaced by the value of the second - * parameter. - * - * @access public - */ + * Set IPTC fields to a specific value or values + * + * @param mixed The field (by number or string) of the IPTC data you wish to update + * @param mixed If the value supplied is scalar, then the block assigned will be set to the given value. If the value supplied is an array, then the entire tag will be given the value of the array. + * @param integer The block to update. Most tags only use the 0th block, but certain tags, like the "keywords" tag, use a list of values. If set to a negative value, the entire tag block will be replaced by the value of the second parameter. + * @access public + */ function setTag( $xTag, $xValue, $nBlock = 0 ) { $sTagName = $this->_lookupTag($xTag); @@ -134,6 +139,9 @@ } } + // }}} + // {{{ getTag() + /** * Get a specific tag/block from the IPTC fields * @@ -163,7 +171,9 @@ return $this->_aIPTC[$sTagName]; - } else if (isset($this->_aIPTC[$sTagName][$nBlock])) { + } + + if (isset($this->_aIPTC[$sTagName][$nBlock])) { return $this->_aIPTC[$sTagName][$nBlock]; @@ -174,6 +184,9 @@ return null; } + // }}} + // {{{ getAllTags() + /** * Get a copy of all IPTC tags extracted from the image * @@ -187,6 +200,9 @@ return $this->_aIPTC; } + // }}} + // {{{ save() + /** * Save the IPTC block to an image file * @@ -222,6 +238,9 @@ return false; } + // }}} + // {{{ output() + /** * Embed IPTC data block and output to standard output * @@ -233,18 +252,16 @@ @iptcembed($sIPTCBlock, $this->_sFilename, 2); } - /** - * Return the numeric code of an IPTC field name - * - * @return integer - * Returns a numeric code corresponding to the name of the IPTC field that - * was supplied. - * - * @param string - * A field name representing the type of tag to return - * - * @access private - */ + // }}} + // {{{ _lookupTag() + + /** + * Return the numeric code of an IPTC field name + * + * @param string A field name representing the type of tag to return + * @return integer Returns a numeric code corresponding to the name of the IPTC field that was supplied. + * @access private + */ function _lookupTag( $sTag ) { $nTag = -1; @@ -383,6 +400,9 @@ return 0; } + // }}} + // {{{ _getIPTCBlock() + /** * Generate an IPTC block from the current tags * @@ -428,6 +448,9 @@ return $sIPTCBlock; } + + // }}} + } -?> +?> \ No newline at end of file

« previous php.pear.cvs (#44930) next »