$entry = $ifd->getEntry(PelTag::DATE_TIME_ORIGINAL);
$time = $entry->getValue();
print('The image was taken on the ' . date('jS', $time));
$entry->setValue($time + 7 * 24 * 3600);
The example used a standard UNIX timestamp, which is the default
for this class.
But the Exif format defines dates outside the range of a UNIX
timestamp (about 1970 to 2038) and so you can also get access to
the timestamp in two other formats: a simple string or a Julian Day
Count. Please see the Calendar extension in the PHP Manual for more
information about the Julian Day Count.
显示文件
Open project: lsolesen/pel
Class Usage Examples
Method | Description | |
---|---|---|
__construct ( $tag, $timestamp, $type = self::UNIX_TIMESTAMP ) | Make a new entry for holding a timestamp. | |
convertGregorianToJd ( integer $year, integer $month, integer $day ) : integer | Converts a date in year/month/day format to a Julian Day count. | |
convertJdToGregorian ( $jd ) : array | Converts a Julian Day count to a year/month/day triple. | |
convertJdToUnix ( integer $jd ) : mixed | Converts a Julian Day count to a UNIX timestamp. | |
convertUnixToJd ( integer $timestamp ) : integer | Converts a UNIX timestamp to a Julian Day count. | |
getValue ( $type = self::UNIX_TIMESTAMP ) : integer | Return the timestamp of the entry. | |
setValue ( $timestamp, $type = self::UNIX_TIMESTAMP ) | Update the timestamp held by this entry. |
public __construct ( $tag, $timestamp, $type = self::UNIX_TIMESTAMP ) |
public convertJdToGregorian ( $jd ) : array | ||
return | array | an array with three entries: year, month, day. |
public convertJdToUnix ( integer $jd ) : mixed | ||
$jd | integer | the Julian Day count. |
return | mixed | $timestamp the integer timestamp or false if the day count cannot be represented as a UNIX timestamp. |
public convertUnixToJd ( integer $timestamp ) : integer | ||
$timestamp | integer | the timestamp. |
return | integer | the Julian Day count. |
public getValue ( $type = self::UNIX_TIMESTAMP ) : integer | ||
return | integer | the timestamp held by this entry in the correct form as indicated by the type argument. For {@link UNIX_TIMESTAMP} this is an integer counting the number of seconds since January 1st 1970, for {@link EXIF_STRING} this is a string of the form 'YYYY:MM:DD hh:mm:ss', and for {@link JULIAN_DAY_COUNT} this is a floating point number where the integer part denotes the day count and the fractional part denotes the time of day (0.25 means 6:00, 0.75 means 18:00). |
public setValue ( $timestamp, $type = self::UNIX_TIMESTAMP ) |