Class PelTiff

Description

Class for handling TIFF data.

EXIF data is actually an extension of the TIFF file format. TIFF images consist of a number of Image File Directories (IFDs), each containing a number of entries. The IFDs are linked to each other --- one can get hold of the first one with the getIfd() method.

To parse a TIFF image for EXIF data one would do:

  1. $tiff = new PelTiff($data);
  2. $ifd0 = $tiff->getIfd();
  3. $exif = $ifd0->getSubIfd(PelTag::EXIF_IFD_POINTER);
  4. $ifd1 = $ifd0->getNextIfd();

Should one have some image data of an unknown type, then the PelTiff::isValid() function is handy: it will quickly test if the data could be valid TIFF data. The PelJpeg::isValid() function does the same for JPEG images.

Located in /PelTiff.php (line 71)


	
			
Class Constant Summary
 TIFF_HEADER = 0x002A
Method Summary
 PelTiff __construct ()
 string getBytes ([PelByteOrder $order = PelConvert::LITTLE_ENDIAN])
 boolean isValid (PelDataWindow $d)
 void load (PelDataWindow $d)
 void loadFile (string $filename)
 void setIfd (PelIfd $ifd)
 string __toString ()
Methods
Constructor __construct (line 96)

Construct a new object for holding TIFF data.

The new object will be empty, containing no PelIfd. Use the setIfd() method to set the IFD explictly, or use the load() method to load TIFF data from a PelDataWindow.

PelTiff __construct ()
getBytes (line 196)

Turn this object into bytes.

TIFF images can have little-endian or big-endian byte order, and so this method takes an argument specifying that.

  • return: the bytes representing this object.
string getBytes ([PelByteOrder $order = PelConvert::LITTLE_ENDIAN])
getIfd (line 178)

Return the first IFD.

  • return: the first IFD contained in the TIFF data, if any. If there is no IFD null will be returned.
PelIfd getIfd ()
isValid (line 255)

Check if data is valid TIFF data.

This will read just enough data from the data window to determine if the data could be a valid TIFF data. This means that the check is more like a heuristic than a rigorous check.

  • return: true if the data looks like valid TIFF data, false otherwise.
  • static:
  • see: PelJpeg::isValid()
boolean isValid (PelDataWindow $d)
load (line 111)

Load TIFF data.

The data given will be parsed and an internal tree representation will be built. If the data cannot be parsed correctly, a PelInvalidDataException is thrown, explaining the problem.

void load (PelDataWindow $d)
  • PelDataWindow $d: the data from which the object will be constructed. This should be valid TIFF data, coming either directly from a TIFF image or from the EXIF data in a JPEG image.
loadFile (line 157)

Load data from a file into a TIFF object.

void loadFile (string $filename)
  • string $filename: the filename. This must be a readable file.
setIfd (line 167)

Set the first IFD.

void setIfd (PelIfd $ifd)
  • PelIfd $ifd: the new first IFD.
__toString (line 232)

Return a string representation of this object.

  • return: a string describing this object. This is mostly useful for debugging.
string __toString ()
Class Constants
TIFF_HEADER = 0x002A (line 78)

TIFF header.

This must follow after the two bytes indicating the byte order.

SourceForge.net Logo Documentation generated on Wed, 21 Jul 2004 19:13:25 +0200 by phpDocumentor 1.3.0RC3