Metadata
in package
Metadata service. This service implements all functionality related to gathering metadata about photos.
Table of Contents
Methods
- populateMetadata() : Photo
- Populates the metadata of a photo based on the EXIF data of the photo.
- exifGetFstop() : string|null
- Computes the relative aperture from the exif data.
- exifGetShutter() : string|null
- Computes the shutter speed from the exif data.
- exifGpsToCoordinate() : float|int|null
- Computes the coordinate for a given exif GPS location.
- frac2dec() : float|int
- Convert a string representing a rational number to a string representing the corresponding decimal approximation.
Methods
populateMetadata()
Populates the metadata of a photo based on the EXIF data of the photo.
public
populateMetadata(Photo $photo, string $path) : Photo
Parameters
- $photo : Photo
-
the photo to add the metadata to
- $path : string
-
The path where the actual image file is stored
Return values
Photo —the photo with the added metadata
exifGetFstop()
Computes the relative aperture from the exif data.
private
exifGetFstop(string $apertureValue) : string|null
Parameters
- $apertureValue : string
-
the aperture value as listed in the photo's exif data
Return values
string|nullexifGetShutter()
Computes the shutter speed from the exif data.
private
exifGetShutter(string $shutterSpeed) : string|null
Parameters
- $shutterSpeed : string
-
the shutter speed as listed in the photo's exif data
Return values
string|nullexifGpsToCoordinate()
Computes the coordinate for a given exif GPS location.
private
static exifGpsToCoordinate(array<string|int, mixed>|string $coordinate, string $hemisphere) : float|int|null
Parameters
- $coordinate : array<string|int, mixed>|string
- $hemisphere : string
Return values
float|int|nullfrac2dec()
Convert a string representing a rational number to a string representing the corresponding decimal approximation.
private
static frac2dec(string $str) : float|int
Parameters
- $str : string
-
the rational number, represented as num+'/'+den
Return values
float|int —the decimal number, represented as float