Skip to content

Commit

Permalink
Read lens model and pass it to EXIF data
Browse files Browse the repository at this point in the history
  • Loading branch information
thekid committed Dec 22, 2024
1 parent a6bd5df commit bf9a673
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main/php/img/io/ExifSegment.class.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php namespace img\io;

use img\util\ExifData;

use util\Objects;

/**
* APP1: EXIF data meta data segment
Expand Down Expand Up @@ -328,7 +328,8 @@ class ExifSegment extends Segment {
0xA40A => 'Sharpness',
0xA40B => 'DeviceSettingDescription',
0xA40C => 'SubjectDistanceRange',
0xA420 => 'ImageUniqueID'
0xA420 => 'ImageUniqueID',
0xA434 => 'LensModel',
];

/**
Expand Down Expand Up @@ -583,7 +584,7 @@ public function rawData($arg= null) {
* @return string
*/
public function toString() {
return nameof($this).'<'.$this->marker.'>'.\xp::stringOf($this->data);
return nameof($this).'<'.$this->marker.'>'.Objects::stringOf($this->data);
}

/**
Expand Down
14 changes: 14 additions & 0 deletions src/main/php/img/util/ExifData.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class ExifData implements Value {
$width = 0,
$make = '',
$model = '',
$lensModel = '',
$flash = 0,
$orientation = 0,
$fileName = '',
Expand Down Expand Up @@ -79,6 +80,17 @@ public function withModel($model) {
return $this;
}

/**
* Set Lens Model
*
* @param string model
* @return self
*/
public function withLensModel($lensModel) {
$this->lensModel= $lensModel;
return $this;
}

/**
* Set Flash
*
Expand Down Expand Up @@ -375,6 +387,7 @@ public function toString() {
" [file ] %s (%d bytes)\n".
" [make ] %s\n".
" [model ] %s\n".
" [lensModel ] %s\n".
" [software ] %s\n".
" [flash ] %d (%s)\n".
" [orientation ] %s (%s, %s)\n".
Expand All @@ -395,6 +408,7 @@ public function toString() {
$this->fileSize,
$this->make,
$this->model,
$this->lensModel,
$this->software,
$this->flash,
$this->flashUsed() ? 'on' : 'off',
Expand Down

0 comments on commit bf9a673

Please sign in to comment.