public function getBytes($order = PelConvert::LITTLE_ENDIAN)
{
if ($order == PelConvert::LITTLE_ENDIAN) {
$bytes = 'II';
} else {
$bytes = 'MM';
}
/* TIFF magic number --- fixed value. */
$bytes .= PelConvert::shortToBytes(self::TIFF_HEADER, $order);
if ($this->ifd !== null) {
/*
* IFD 0 offset. We will always start IDF 0 at an offset of 8
* bytes (2 bytes for byte order, another 2 bytes for the TIFF
* header, and 4 bytes for the IFD 0 offset make 8 bytes
* together).
*/
$bytes .= PelConvert::longToBytes(8, $order);
/*
* The argument specifies the offset of this IFD. The IFD will
* use this to calculate offsets from the entries to their data,
* all those offsets are absolute offsets counted from the
* beginning of the data.
*/
$bytes .= $this->ifd->getBytes(8, $order);
} else {
$bytes .= PelConvert::longToBytes(0, $order);
}
return $bytes;
}