Skip to content

Commit

Permalink
Default to the image filename if no title field can be found.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Jun 17, 2014
1 parent 7c13445 commit 8f5493f
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions ansel/lib/Image.php
Expand Up @@ -722,38 +722,30 @@ public function getEXIF($replacing = false)
}
$this->_exif = $this->_getAttributeObject()->imageAttributes($exif_fields, $replacing);

// Flag to determine if we need to resave the image data.
$needUpdate = false;

// Populate any local properties that come from EXIF
if (!empty($exif_fields['GPSLatitude'])) {
$this->lat = $exif_fields['GPSLatitude'];
$this->lng = $exif_fields['GPSLongitude'];
$this->geotag_timestamp = time();
$needUpdate = true;
}

if (!empty($exif_fields['DateTimeOriginal'])) {
$this->originalDate = $exif_fields['DateTimeOriginal'];
$needUpdate = true;
}

// Overwrite any existing value for title and caption with exif data
if ($exif_title = $this->_getAttributeObject()->getTitle()) {
$this->title = $exif_title;
$needUpdate = true;
}
$exif_title = $this->_getAttributeObject()->getTitle();
$this->title = empty($exif_title) ? $this->filename : $exif_title;
if ($exif_caption = $this->_getAttributeObject()->getCaption()) {
$this->caption = $exif_caption;
$needUpdate = true;
}

// Attempt to autorotate based on Orientation field
if (!empty($exif_fields['Orientation'])) {
$this->_autoRotate($exif_fields['Orientation']);
}

return $needUpdate;
return true;
}

/**
Expand Down

0 comments on commit 8f5493f

Please sign in to comment.