Class PelEntryRational

Description

Class for holding unsigned rational numbers.

This class can hold rational numbers, consisting of a numerator and denominator both of which are of type unsigned long. Each rational is represented by an array with just two entries: the numerator and the denominator, in that order.

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 PelFormat::RATIONAL like in this example:

  1.  $resolution $ifd->getEntry(PelTag::X_RESOLUTION);
  2.  $resolution->setValue(array(1300));

Here the x-resolution is adjusted to 1/300, which will be 300 DPI, unless the resolution unit is set to something different than 2 which means inches.

Located in /src/PelEntryRational.php (line 68)

PelEntry
   |
   --PelEntryNumber
      |
      --PelEntryLong
         |
         --PelEntryRational
Method Summary
PelEntryRational __construct (PelTag $tag, array $value...)
string formatNumber (array $number, [boolean $brief = false])
string getText ([boolean $brief = false])
Variables
Methods
Constructor __construct (line 86)

Make a new entry that can hold an unsigned rational.

PelEntryRational __construct (PelTag $tag, array $value...)
  • array $value...: the rational(s) that this entry will represent. The arguments passed must obey the same rules as the argument to setValue, namely that each argument should be an array with two entries, both of which must be within range of an unsigned long (32 bit), that is between 0 and 4294967295 (inclusive). If not, then a PelOverflowException will be thrown.
  • PelTag $tag: the tag which this entry represents. This should be one of the constants defined in PelTag, e.g., PelTag::X_RESOLUTION, or any other tag which can have format PelFormat::RATIONAL.

Redefinition of:
PelEntryLong::__construct()
Make a new entry that can hold an unsigned long.
formatNumber (line 112)

Format a rational number.

The rational will be returned as a string with a slash '/' between the numerator and denominator.

  • return: the rational formatted as a string suitable for display.
string formatNumber (array $number, [boolean $brief = false])
  • array $number: the rational which will be formatted.
  • boolean $brief: not used.

Redefinition of:
PelEntryNumber::formatNumber()
Format a number.
getText (line 129)

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.

  • return: the value as text.
string getText ([boolean $brief = false])
  • boolean $brief: some values can be returned in a long or more brief form, and this parameter controls that.

Redefinition of:
PelEntryNumber::getText()
Get the numeric value of this entry as text.

Inherited Methods

Inherited From PelEntryLong

PelEntryLong::__construct()
PelEntryLong::numberToBytes()

Inherited From PelEntryNumber

PelEntryNumber::addNumber()
PelEntryNumber::formatNumber()
PelEntryNumber::getBytes()
PelEntryNumber::getText()
PelEntryNumber::getValue()
PelEntryNumber::numberToBytes()
PelEntryNumber::setValue()
PelEntryNumber::setValueArray()
PelEntryNumber::validateNumber()

Inherited From PelEntry

PelEntry::getBytes()
PelEntry::getComponents()
PelEntry::getFormat()
PelEntry::getIfdType()
PelEntry::getTag()
PelEntry::getText()
PelEntry::getValue()
PelEntry::setIfdType()
PelEntry::setValue()
PelEntry::__toString()

Documentation generated on Thu, 05 May 2011 07:19:05 +0200 by phpDocumentor 1.4.3