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(PelIfd::EXIF);
  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 /src/PelTiff.php (line 71)


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

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.
  • see: PelJpeg::isValid()
static boolean isValid (PelDataWindow $d)
Constructor __construct (line 100)

Construct a new object for holding TIFF data.

The new object will be empty (with no PelIfd) unless an argument is given from which it can initialize itself. This can either be the filename of a TIFF image or a PelDataWindow object.

Use setIfd() to explicitly set the IFD.

PelTiff __construct ([ $data = false])
  • $data
getBytes (line 218)

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 200)

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 ()
load (line 128)

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 174)

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 185)

Set the first IFD.

void setIfd (PelIfd $ifd)
__toString (line 254)

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.

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