PHP Класс lsolesen\pel\PelTiff

Exif data is actually an extension of the TIFF file format. TIFF images consist of a number of {@link PelIfd Image File Directories} (IFDs), each containing a number of {@link PelEntry entries}. The IFDs are linked to each other --- one can get hold of the first one with the {@link getIfd()} method. To parse a TIFF image for Exif data one would do: $tiff = new PelTiff($data); $ifd0 = $tiff->getIfd(); $exif = $ifd0->getSubIfd(PelIfd::EXIF); $ifd1 = $ifd0->getNextIfd(); Should one have some image data of an unknown type, then the {@link PelTiff::isValid()} function is handy: it will quickly test if the data could be valid TIFF data. The {@link PelJpeg::isValid()} function does the same for JPEG images.
Автор: Martin Geisler ([email protected])
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( $data = false ) Construct a new object for holding TIFF data.
__toString ( ) : string Return a string representation of this object.
getBytes ( PelByteOrder $order = PelConvert::LITTLE_ENDIAN ) : string Turn this object into bytes.
getIfd ( ) : PelIfd Return the first IFD.
isValid ( lsolesen\pel\PelDataWindow $d ) : boolean Check if data is valid TIFF data.
load ( lsolesen\pel\PelDataWindow $d ) Load TIFF data.
loadFile ( string $filename ) Load data from a file into a TIFF object.
setIfd ( PelIfd $ifd ) Set the first IFD.

Описание методов

__construct() публичный Метод

The new object will be empty (with no {@link PelIfd}) unless an argument is given from which it can initialize itself. This can either be the filename of a TIFF image or a {@link PelDataWindow} object. Use {@link setIfd()} to explicitly set the IFD.
public __construct ( $data = false )

__toString() публичный Метод

Return a string representation of this object.
public __toString ( ) : string
Результат string a string describing this object. This is mostly useful for debugging.

getBytes() публичный Метод

TIFF images can have {@link PelConvert::LITTLE_ENDIAN little-endian} or {@link PelConvert::BIG_ENDIAN big-endian} byte order, and so this method takes an argument specifying that.
public getBytes ( PelByteOrder $order = PelConvert::LITTLE_ENDIAN ) : string
$order PelByteOrder the desired byte order of the TIFF data. This should be one of {@link PelConvert::LITTLE_ENDIAN} or {@link PelConvert::BIG_ENDIAN}.
Результат string the bytes representing this object.

getIfd() публичный Метод

Return the first IFD.
public getIfd ( ) : PelIfd
Результат PelIfd the first IFD contained in the TIFF data, if any. If there is no IFD null will be returned.

isValid() публичный статический Метод

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.
См. также: PelJpeg::isValid()
public static isValid ( lsolesen\pel\PelDataWindow $d ) : boolean
$d lsolesen\pel\PelDataWindow the bytes that will be examined.
Результат boolean true if the data looks like valid TIFF data, false otherwise.

load() публичный Метод

The data given will be parsed and an internal tree representation will be built. If the data cannot be parsed correctly, a {@link PelInvalidDataException} is thrown, explaining the problem.
public load ( lsolesen\pel\PelDataWindow $d )
$d lsolesen\pel\PelDataWindow

loadFile() публичный Метод

Load data from a file into a TIFF object.
public loadFile ( string $filename )
$filename string the filename. This must be a readable file.

setIfd() публичный Метод

Set the first IFD.
public setIfd ( PelIfd $ifd )
$ifd PelIfd the new first IFD, which must be of type {@link PelIfd::IFD0}.