PHP 클래스 lsolesen\pel\PelIfd

{@link PelTiff TIFF data} is structured as a number of Image File Directories, IFDs for short. Each IFD contains a number of {@link PelEntry entries}, some data and finally a link to the next IFD.
저자: Martin Geisler ([email protected])
상속: implements IteratorAggregate, implements ArrayAccess
파일 보기 프로젝트 열기: lsolesen/pel 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( $type ) Construct a new Image File Directory (IFD).
__toString ( ) : string Turn this directory into text.
addEntry ( lsolesen\pel\PelEntry $e ) Adds an entry to the directory.
addSubIfd ( PelIfd $sub ) Add a sub-IFD.
getBytes ( integer $offset, PelByteOrder $order ) Turn this directory into bytes.
getEntries ( ) : array Returns all entries contained in this IFD.
getEntry ( lsolesen\pel\PelTag $tag ) : lsolesen\pel\PelEntry Retrieve an entry.
getIterator ( ) : Iterator Return an iterator for all entries contained in this IFD.
getName ( ) : string Get the name of this directory.
getNextIfd ( ) : PelIfd Return the IFD pointed to by this directory.
getSubIfd ( integer $type ) : PelIfd Return a sub IFD.
getSubIfds ( ) : array Get all sub IFDs.
getThumbnailData ( ) : string Returns available thumbnail data.
getType ( ) : integer Get the type of this directory.
getTypeName ( integer $type ) : string Get the name of an IFD type.
getValidTags ( ) : array Returns a list of valid tags for this IFD.
isLastIfd ( ) : boolean Check if this is the last IFD.
isValidTag ( lsolesen\pel\PelTag $tag ) : boolean Is a given tag valid for this IFD?
load ( lsolesen\pel\PelDataWindow $d, integer $offset ) Load data into a Image File Directory (IFD).
newEntryFromData ( lsolesen\pel\PelTag $tag, lsolesen\pel\PelFormat $format, integer $components, lsolesen\pel\PelDataWindow $data ) : lsolesen\pel\PelEntry Make a new entry from a bunch of bytes.
offsetExists ( lsolesen\pel\PelTag $tag ) : boolean Does a given tag exist in this IFD?
offsetGet ( lsolesen\pel\PelTag $tag ) : lsolesen\pel\PelEntry Retrieve a given tag from this IFD.
offsetSet ( lsolesen\pel\PelTag $tag, lsolesen\pel\PelEntry $e ) Set or update a given tag in this IFD.
offsetUnset ( lsolesen\pel\PelTag $tag ) Unset a given tag in this IFD.
setNextIfd ( PelIfd $i ) Make this directory point to a new directory.
setThumbnail ( lsolesen\pel\PelDataWindow $d ) Set thumbnail data.

비공개 메소드들

메소드 설명
safeSetThumbnail ( lsolesen\pel\PelDataWindow $d, integer $offset, integer $length ) Extract thumbnail data safely.

메소드 상세

__construct() 공개 메소드

The IFD will be empty, use the {@link addEntry()} method to add an {@link PelEntry}. Use the {@link setNext()} method to link this IFD to another.
public __construct ( $type )

__toString() 공개 메소드

Turn this directory into text.
public __toString ( ) : string
리턴 string information about the directory, mainly for debugging.

addEntry() 공개 메소드

Adds an entry to the directory.
public addEntry ( lsolesen\pel\PelEntry $e )
$e lsolesen\pel\PelEntry the entry that will be added. If the entry is not valid in this IFD (as per {@link isValidTag()}) an {@link PelInvalidDataException} is thrown.

addSubIfd() 공개 메소드

Any previous sub-IFD of the same type will be overwritten.
public addSubIfd ( PelIfd $sub )
$sub PelIfd the sub IFD. The type of must be one of {@link PelIfd::EXIF}, {@link PelIfd::GPS}, or {@link PelIfd::INTEROPERABILITY}.

getBytes() 공개 메소드

This directory will be turned into a byte string, with the specified byte order. The offsets will be calculated from the offset given.
public getBytes ( integer $offset, PelByteOrder $order )
$offset integer the offset of the first byte of this directory.
$order PelByteOrder the byte order that should be used when turning integers into bytes. This should be one of {@link PelConvert::LITTLE_ENDIAN} and {@link PelConvert::BIG_ENDIAN}.

getEntries() 공개 메소드

Returns all entries contained in this IFD.
또한 보기: getEntry
또한 보기: getIterator
public getEntries ( ) : array
리턴 array an array of {@link PelEntry} objects, or rather descendant classes. The array has {@link PelTag}s as keys and the entries as values.

getEntry() 공개 메소드

Retrieve an entry.
public getEntry ( lsolesen\pel\PelTag $tag ) : lsolesen\pel\PelEntry
$tag lsolesen\pel\PelTag the tag identifying the entry.
리턴 lsolesen\pel\PelEntry the entry associated with the tag, or null if no such entry exists.

getIterator() 공개 메소드

Used with foreach as in foreach ($ifd as $tag => $entry) { $tag is now a PelTag and $entry is a PelEntry object. }
public getIterator ( ) : Iterator
리턴 Iterator an iterator using the {@link PelTag tags} as keys and the entries as values.

getName() 공개 메소드

Get the name of this directory.
public getName ( ) : string
리턴 string the name of this directory.

getNextIfd() 공개 메소드

Return the IFD pointed to by this directory.
public getNextIfd ( ) : PelIfd
리턴 PelIfd the next IFD, following this IFD. If this is the last IFD, null is returned.

getSubIfd() 공개 메소드

Return a sub IFD.
public getSubIfd ( integer $type ) : PelIfd
$type integer the type of the sub IFD. This must be one of {@link PelIfd::EXIF}, {@link PelIfd::GPS}, or {@link PelIfd::INTEROPERABILITY}.
리턴 PelIfd the IFD associated with the type, or null if that sub IFD does not exist.

getSubIfds() 공개 메소드

Get all sub IFDs.
public getSubIfds ( ) : array
리턴 array an associative array with (IFD-type, {@link PelIfd}) pairs.

getThumbnailData() 공개 메소드

Returns available thumbnail data.
public getThumbnailData ( ) : string
리턴 string the bytes in the thumbnail, if any. If the IFD does not contain any thumbnail data, the empty string is returned.

getType() 공개 메소드

Get the type of this directory.
public getType ( ) : integer
리턴 integer of {@link PelIfd::IFD0}, {@link PelIfd::IFD1}, {@link PelIfd::EXIF}, {@link PelIfd::GPS}, or {@link PelIfd::INTEROPERABILITY}.

getTypeName() 공개 정적인 메소드

Get the name of an IFD type.
public static getTypeName ( integer $type ) : string
$type integer one of {@link PelIfd::IFD0}, {@link PelIfd::IFD1}, {@link PelIfd::EXIF}, {@link PelIfd::GPS}, or {@link PelIfd::INTEROPERABILITY}.
리턴 string the name of type.

getValidTags() 공개 메소드

Returns a list of valid tags for this IFD.
public getValidTags ( ) : array
리턴 array an array of {@link PelTag}s which are valid for this IFD.

isLastIfd() 공개 메소드

Check if this is the last IFD.
public isLastIfd ( ) : boolean
리턴 boolean true if there are no following IFD, false otherwise.

isValidTag() 공개 메소드

Different types of IFDs can contain different kinds of tags --- the {@link IFD0} type, for example, cannot contain a {@link PelTag::GPS_LONGITUDE} tag. A special exception is tags with values above 0xF000. They are treated as private tags and will be allowed everywhere (use this for testing or for implementing your own types of tags).
또한 보기: getValidTags()
public isValidTag ( lsolesen\pel\PelTag $tag ) : boolean
$tag lsolesen\pel\PelTag the tag.
리턴 boolean true if the tag is considered valid in this IFD, false otherwise.

load() 공개 메소드

Load data into a Image File Directory (IFD).
public load ( lsolesen\pel\PelDataWindow $d, integer $offset )
$d lsolesen\pel\PelDataWindow the data window that will provide the data.
$offset integer the offset within the window where the directory will be found.

newEntryFromData() 공개 메소드

This method will create the proper subclass of {@link PelEntry} corresponding to the {@link PelTag} and {@link PelFormat} given. The entry will be initialized with the data given. Please note that the data you pass to this method should come from an image, that is, it should be raw bytes. If instead you want to create an entry for holding, say, an short integer, then create a {@link PelEntryShort} object directly and load the data into it. A {@link PelUnexpectedFormatException} is thrown if a mismatch is discovered between the tag and format, and likewise a {@link PelWrongComponentCountException} is thrown if the number of components does not match the requirements of the tag. The requirements for a given tag (if any) can be found in the documentation for {@link PelTag}.
public newEntryFromData ( lsolesen\pel\PelTag $tag, lsolesen\pel\PelFormat $format, integer $components, lsolesen\pel\PelDataWindow $data ) : lsolesen\pel\PelEntry
$tag lsolesen\pel\PelTag the tag of the entry.
$format lsolesen\pel\PelFormat the format of the entry.
$components integer the components in the entry.
$data lsolesen\pel\PelDataWindow the data which will be used to construct the entry.
리턴 lsolesen\pel\PelEntry a newly created entry, holding the data given.

offsetExists() 공개 메소드

This methods is part of the ArrayAccess SPL interface for overriding array access of objects, it allows you to check for existance of an entry in the IFD: if (isset($ifd[PelTag::FNUMBER])) ... do something with the F-number.
public offsetExists ( lsolesen\pel\PelTag $tag ) : boolean
$tag lsolesen\pel\PelTag the offset to check.
리턴 boolean whether the tag exists.

offsetGet() 공개 메소드

This methods is part of the ArrayAccess SPL interface for overriding array access of objects, it allows you to read entries from the IFD the same was as for an array: $entry = $ifd[PelTag::FNUMBER];
public offsetGet ( lsolesen\pel\PelTag $tag ) : lsolesen\pel\PelEntry
$tag lsolesen\pel\PelTag the tag to return. It is an error to ask for a tag which is not in the IFD, just like asking for a non-existant array entry.
리턴 lsolesen\pel\PelEntry the entry.

offsetSet() 공개 메소드

This methods is part of the ArrayAccess SPL interface for overriding array access of objects, it allows you to add new entries or replace esisting entries by doing: $ifd[PelTag::EXPOSURE_BIAS_VALUE] = $entry; Note that the actual array index passed is ignored! Instead the {@link PelTag} from the entry is used.
public offsetSet ( lsolesen\pel\PelTag $tag, lsolesen\pel\PelEntry $e )
$tag lsolesen\pel\PelTag the offset to update.
$e lsolesen\pel\PelEntry the new value.

offsetUnset() 공개 메소드

This methods is part of the ArrayAccess SPL interface for overriding array access of objects, it allows you to delete entries in the IFD by doing: unset($ifd[PelTag::EXPOSURE_BIAS_VALUE])
public offsetUnset ( lsolesen\pel\PelTag $tag )
$tag lsolesen\pel\PelTag the offset to delete.

setNextIfd() 공개 메소드

Make this directory point to a new directory.
public setNextIfd ( PelIfd $i )
$i PelIfd the IFD that this directory will point to.

setThumbnail() 공개 메소드

Use this to embed an arbitrary JPEG image within this IFD. The data will be checked to ensure that it has a proper {@link PelJpegMarker::EOI} at the end. If not, then the length is adjusted until one if found. An {@link PelIfdException} might be thrown (depending on {@link Pel::$strict}) this case.
public setThumbnail ( lsolesen\pel\PelDataWindow $d )
$d lsolesen\pel\PelDataWindow the thumbnail data.