Update Composer packages
This commit is contained in:
parent
0320235f6c
commit
a8b68fb61b
378 changed files with 28466 additions and 28852 deletions
|
@ -16,75 +16,55 @@ use Kirby\Toolkit\V;
|
|||
class Exif
|
||||
{
|
||||
/**
|
||||
* the parent image object
|
||||
* @var \Kirby\Image\Image
|
||||
* The parent image object
|
||||
*/
|
||||
protected $image;
|
||||
protected Image $image;
|
||||
|
||||
/**
|
||||
* the raw exif array
|
||||
* @var array
|
||||
* The raw exif array
|
||||
*/
|
||||
protected $data = [];
|
||||
protected array $data = [];
|
||||
|
||||
/**
|
||||
* the camera object with model and make
|
||||
* @var Camera
|
||||
* The camera object with model and make
|
||||
*/
|
||||
protected $camera;
|
||||
protected Camera|null $camera = null;
|
||||
|
||||
/**
|
||||
* the location object
|
||||
* @var Location
|
||||
* The location object
|
||||
*/
|
||||
protected $location;
|
||||
protected Location|null $location = null;
|
||||
|
||||
/**
|
||||
* the timestamp
|
||||
*
|
||||
* @var string
|
||||
* The timestamp
|
||||
*/
|
||||
protected $timestamp;
|
||||
protected string|null $timestamp = null;
|
||||
|
||||
/**
|
||||
* the exposure value
|
||||
*
|
||||
* @var string
|
||||
* The exposure value
|
||||
*/
|
||||
protected $exposure;
|
||||
protected string|null $exposure = null;
|
||||
|
||||
/**
|
||||
* the aperture value
|
||||
*
|
||||
* @var string
|
||||
* The aperture value
|
||||
*/
|
||||
protected $aperture;
|
||||
protected string|null $aperture = null;
|
||||
|
||||
/**
|
||||
* iso value
|
||||
*
|
||||
* @var string
|
||||
* ISO value
|
||||
*/
|
||||
protected $iso;
|
||||
protected string|null $iso = null;
|
||||
|
||||
/**
|
||||
* focal length
|
||||
*
|
||||
* @var string
|
||||
* Focal length
|
||||
*/
|
||||
protected $focalLength;
|
||||
protected string|null $focalLength = null;
|
||||
|
||||
/**
|
||||
* color or black/white
|
||||
* @var bool
|
||||
* Color or black/white
|
||||
*/
|
||||
protected $isColor;
|
||||
protected bool|null $isColor = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param \Kirby\Image\Image $image
|
||||
*/
|
||||
public function __construct(Image $image)
|
||||
{
|
||||
$this->image = $image;
|
||||
|
@ -94,8 +74,6 @@ class Exif
|
|||
|
||||
/**
|
||||
* Returns the raw data array from the parser
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function data(): array
|
||||
{
|
||||
|
@ -104,10 +82,8 @@ class Exif
|
|||
|
||||
/**
|
||||
* Returns the Camera object
|
||||
*
|
||||
* @return \Kirby\Image\Camera|null
|
||||
*/
|
||||
public function camera()
|
||||
public function camera(): Camera
|
||||
{
|
||||
if ($this->camera !== null) {
|
||||
return $this->camera;
|
||||
|
@ -118,10 +94,8 @@ class Exif
|
|||
|
||||
/**
|
||||
* Returns the location object
|
||||
*
|
||||
* @return \Kirby\Image\Location|null
|
||||
*/
|
||||
public function location()
|
||||
public function location(): Location
|
||||
{
|
||||
if ($this->location !== null) {
|
||||
return $this->location;
|
||||
|
@ -132,78 +106,62 @@ class Exif
|
|||
|
||||
/**
|
||||
* Returns the timestamp
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function timestamp()
|
||||
public function timestamp(): string|null
|
||||
{
|
||||
return $this->timestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the exposure
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function exposure()
|
||||
public function exposure(): string|null
|
||||
{
|
||||
return $this->exposure;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the aperture
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function aperture()
|
||||
public function aperture(): string|null
|
||||
{
|
||||
return $this->aperture;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the iso value
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function iso()
|
||||
public function iso(): string|null
|
||||
{
|
||||
return $this->iso;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if this is a color picture
|
||||
*
|
||||
* @return bool|null
|
||||
*/
|
||||
public function isColor()
|
||||
public function isColor(): bool|null
|
||||
{
|
||||
return $this->isColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if this is a bw picture
|
||||
*
|
||||
* @return bool|null
|
||||
*/
|
||||
public function isBW(): ?bool
|
||||
public function isBW(): bool|null
|
||||
{
|
||||
return ($this->isColor !== null) ? $this->isColor === false : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the focal length
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function focalLength()
|
||||
public function focalLength(): string|null
|
||||
{
|
||||
return $this->focalLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the exif data of the image object if possible
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function read(): array
|
||||
{
|
||||
|
@ -219,8 +177,6 @@ class Exif
|
|||
|
||||
/**
|
||||
* Get all computed data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function computed(): array
|
||||
{
|
||||
|
@ -228,9 +184,9 @@ class Exif
|
|||
}
|
||||
|
||||
/**
|
||||
* Pareses and stores all relevant exif data
|
||||
* Parses and stores all relevant exif data
|
||||
*/
|
||||
protected function parse()
|
||||
protected function parse(): void
|
||||
{
|
||||
$this->timestamp = $this->parseTimestamp();
|
||||
$this->exposure = $this->data['ExposureTime'] ?? null;
|
||||
|
@ -242,13 +198,13 @@ class Exif
|
|||
|
||||
/**
|
||||
* Return the timestamp when the picture has been taken
|
||||
*
|
||||
* @return string|int
|
||||
*/
|
||||
protected function parseTimestamp()
|
||||
protected function parseTimestamp(): string
|
||||
{
|
||||
if (isset($this->data['DateTimeOriginal']) === true) {
|
||||
return strtotime($this->data['DateTimeOriginal']);
|
||||
if ($time = strtotime($this->data['DateTimeOriginal'])) {
|
||||
return (string)$time;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->data['FileDateTime'] ?? $this->image->modified();
|
||||
|
@ -256,24 +212,22 @@ class Exif
|
|||
|
||||
/**
|
||||
* Return the focal length
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
protected function parseFocalLength()
|
||||
protected function parseFocalLength(): string|null
|
||||
{
|
||||
return $this->data['FocalLength'] ?? $this->data['FocalLengthIn35mmFilm'] ?? null;
|
||||
return $this->data['FocalLength'] ??
|
||||
$this->data['FocalLengthIn35mmFilm'] ??
|
||||
null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the object into a nicely readable array
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'camera' => $this->camera() ? $this->camera()->toArray() : null,
|
||||
'location' => $this->location() ? $this->location()->toArray() : null,
|
||||
'camera' => $this->camera()->toArray(),
|
||||
'location' => $this->location()->toArray(),
|
||||
'timestamp' => $this->timestamp(),
|
||||
'exposure' => $this->exposure(),
|
||||
'aperture' => $this->aperture(),
|
||||
|
@ -285,8 +239,6 @@ class Exif
|
|||
|
||||
/**
|
||||
* Improved `var_dump` output
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function __debugInfo(): array
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue