Source for file PelEntryShort.php
Documentation is available at PelEntryShort.php
/* PEL: PHP Exif Library. A library with support for reading and
* writing all Exif headers in JPEG and TIFF images using PHP.
* Copyright (C) 2004, 2005, 2006 Martin Geisler.
* 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., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301 USA
* Classes used to hold shorts, both signed and unsigned.
* @author Martin Geisler <mgeisler@users.sourceforge.net>
* @license http://www.gnu.org/licenses/gpl.html GNU General Public
/**#@+ Required class definitions. */
require_once('PelEntryNumber.php');
require_once('PelConvert.php');
* Class for holding signed shorts.
* This class can hold shorts, either just a single short or an array
* of shorts. The class will be used to manipulate any of the Exif
* tags which has format {@link PelFormat::SHORT} like in this
* $w = $ifd->getEntry(PelTag::EXIF_IMAGE_WIDTH);
* $w->setValue($w->getValue() / 2);
* $h = $ifd->getEntry(PelTag::EXIF_IMAGE_HEIGHT);
* $h->setValue($h->getValue() / 2);
* Here the width and height is updated to 50% of their original
* @author Martin Geisler <mgeisler@users.sourceforge.net>
* Make a new entry that can hold an unsigned short.
* The method accept several integer arguments. The {@link }
* getValue} method will always return an array except for when a
* single integer argument is given here.
* This means that one can conveniently use objects like this:
* $a = new PelEntryShort(PelTag::EXIF_IMAGE_HEIGHT, 42);
* $b = $a->getValue() + 314;
* where the call to {@link getValue} will return an integer
* instead of an array with one integer element, which would then
* @param PelTag the tag which this entry represents. This should be
* one of the constants defined in {@link PelTag}, e.g., {@link }
* PelTag::IMAGE_WIDTH}, {@link PelTag::ISO_SPEED_RATINGS},
* or any other tag with format {@link PelFormat::SHORT}.
* @param int $value... the short(s) that this entry will
* represent. The argument passed must obey the same rules as the
* argument to {@link setValue}, namely that it should be within
* range of an unsigned short, that is between 0 and 65535
* (inclusive). If not, then a {@link PelOverFlowException} will be
* Convert a number into bytes.
* @param int the number that should be converted.
* @param PelByteOrder one of {@link PelConvert::LITTLE_ENDIAN} and
* {@link PelConvert::BIG_ENDIAN}, specifying the target byte order.
* @return string bytes representing the number given.
* Get the value of an entry as text.
* The value will be returned in a format suitable for presentation,
* e.g., instead of returning '2' for a {@link }
* PelTag::METERING_MODE} tag, 'Center-Weighted Average' is
* @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.
//CC (e->components, 1, v);
switch ($this->value[0]) {
return Pel::tra('Center-Weighted Average');
return Pel::tra('Multi Spot');
//CC (e->components, 1, v);
switch ($this->value[0]) {
return Pel::tra('Uncompressed');
return Pel::tra('JPEG compression');
case PelTag::PLANAR_CONFIGURATION:
//CC (e->components, 1, v);
switch ($this->value[0]) {
return Pel::tra('chunky format');
return Pel::tra('planar format');
//CC (e->components, 1, v);
switch ($this->value[0]) {
return Pel::tra('Not defined');
return Pel::tra('One-chip color area sensor');
return Pel::tra('Two-chip color area sensor');
return Pel::tra('Three-chip color area sensor');
return Pel::tra('Color sequential area sensor');
return Pel::tra('Trilinear sensor');
return Pel::tra('Color sequential linear sensor');
//CC (e->components, 1, v);
switch ($this->value[0]) {
return Pel::tra('Fluorescent');
return Pel::tra('Tungsten (incandescent light)');
return Pel::tra('Fine weather');
return Pel::tra('Cloudy weather');
return Pel::tra('Daylight fluorescent');
return Pel::tra('Day white fluorescent');
return Pel::tra('Cool white fluorescent');
return Pel::tra('White fluorescent');
return Pel::tra('Standard light A');
return Pel::tra('Standard light B');
return Pel::tra('Standard light C');
return Pel::tra('ISO studio tungsten');
case PelTag::FOCAL_PLANE_RESOLUTION_UNIT:
//CC (e->components, 1, v);
switch ($this->value[0]) {
return Pel::tra('Centimeter');
case PelTag::EXPOSURE_PROGRAM:
//CC (e->components, 1, v);
switch ($this->value[0]) {
return Pel::tra('Not defined');
return Pel::tra('Normal program');
return Pel::tra('Aperture priority');
return Pel::tra('Shutter priority');
return Pel::tra('Creative program (biased toward depth of field)');
return Pel::tra('Action program (biased toward fast shutter speed)');
return Pel::tra('Portrait mode (for closeup photos with the background out of focus');
return Pel::tra('Landscape mode (for landscape photos with the background in focus');
//CC (e->components, 1, v);
switch ($this->value[0]) {
return Pel::tra('top - left');
return Pel::tra('top - right');
return Pel::tra('bottom - right');
return Pel::tra('bottom - left');
return Pel::tra('left - top');
return Pel::tra('right - top');
return Pel::tra('right - bottom');
return Pel::tra('left - bottom');
case PelTag::YCBCR_POSITIONING:
//CC (e->components, 1, v);
switch ($this->value[0]) {
case PelTag::YCBCR_SUB_SAMPLING:
//CC (e->components, 2, v);
case PelTag::PHOTOMETRIC_INTERPRETATION:
//CC (e->components, 1, v);
switch ($this->value[0]) {
//CC (e->components, 1, v);
switch ($this->value[0]) {
return Pel::tra('Uncalibrated');
//CC (e->components, 1, v);
switch ($this->value[0]) {
return Pel::tra('Flash did not fire.');
return Pel::tra('Flash fired.');
return Pel::tra('Strobe return light not detected.');
return Pel::tra('Strobe return light detected.');
return Pel::tra('Flash fired, compulsory flash mode.');
return Pel::tra('Flash fired, compulsory flash mode, return light not detected.');
return Pel::tra('Flash fired, compulsory flash mode, return light detected.');
return Pel::tra('Flash did not fire, compulsory flash mode.');
return Pel::tra('Flash did not fire, auto mode.');
return Pel::tra('Flash fired, auto mode.');
return Pel::tra('Flash fired, auto mode, return light not detected.');
return Pel::tra('Flash fired, auto mode, return light detected.');
return Pel::tra('No flash function.');
return Pel::tra('Flash fired, red-eye reduction mode.');
return Pel::tra('Flash fired, red-eye reduction mode, return light not detected.');
return Pel::tra('Flash fired, red-eye reduction mode, return light detected.');
return Pel::tra('Flash fired, compulsory flash mode, red-eye reduction mode.');
return Pel::tra('Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected.');
return Pel::tra('Flash fired, compulsory flash mode, red-eye reduction mode, return light detected.');
return Pel::tra('Flash did not fire, auto mode, red-eye reduction mode.');
return Pel::tra('Flash fired, auto mode, red-eye reduction mode.');
return Pel::tra('Flash fired, auto mode, return light not detected, red-eye reduction mode.');
return Pel::tra('Flash fired, auto mode, return light detected, red-eye reduction mode.');
//CC (e->components, 1, v);
switch ($this->value[0]) {
return Pel::tra('Normal process');
return Pel::tra('Custom process');
//CC (e->components, 1, v);
switch ($this->value[0]) {
return Pel::tra('Auto exposure');
return Pel::tra('Manual exposure');
return Pel::tra('Auto bracket');
//CC (e->components, 1, v);
switch ($this->value[0]) {
return Pel::tra('Auto white balance');
return Pel::tra('Manual white balance');
case PelTag::SCENE_CAPTURE_TYPE:
//CC (e->components, 1, v);
switch ($this->value[0]) {
return Pel::tra('Night scene');
//CC (e->components, 1, v);
switch ($this->value[0]) {
return Pel::tra('Low gain up');
return Pel::tra('High gain up');
return Pel::tra('Low gain down');
return Pel::tra('High gain down');
//CC (e->components, 1, v);
switch ($this->value[0]) {
return Pel::tra('Low saturation');
return Pel::tra('High saturation');
//CC (e->components, 1, v);
switch ($this->value[0]) {
case PelTag::SUBJECT_DISTANCE_RANGE:
//CC (e->components, 1, v);
switch ($this->value[0]) {
return Pel::tra('Close view');
return Pel::tra('Distant view');
return Pel::fmt('Within distance %d of (x,y) = (%d,%d)',
return Pel::fmt('Within rectangle (width %d, height %d) around (x,y) = (%d,%d)',
return Pel::fmt('Unexpected number of components (%d, expected 2, 3, or 4).', $this->components);
* Class for holding signed shorts.
* This class can hold shorts, either just a single short or an array
* of shorts. The class will be used to manipulate any of the Exif
* tags which has format {@link PelFormat::SSHORT}.
* @author Martin Geisler <mgeisler@users.sourceforge.net>
* Make a new entry that can hold a signed short.
* The method accept several integer arguments. The {@link }
* getValue} method will always return an array except for when a
* single integer argument is given here.
* @param PelTag the tag which this entry represents. This
* should be one of the constants defined in {@link PelTag}
* which has format {@link PelFormat::SSHORT}.
* @param int $value... the signed short(s) that this entry will
* represent. The argument passed must obey the same rules as the
* argument to {@link setValue}, namely that it should be within
* range of a signed short, that is between -32768 to 32767
* (inclusive). If not, then a {@link PelOverFlowException} will be
* Convert a number into bytes.
* @param int the number that should be converted.
* @param PelByteOrder one of {@link PelConvert::LITTLE_ENDIAN} and
* {@link PelConvert::BIG_ENDIAN}, specifying the target byte order.
* @return string bytes representing the number given.
Documentation generated on Thu, 05 May 2011 07:19:08 +0200 by phpDocumentor 1.4.3