Helper function to change GPS co-ords into decimals.
Parameters
string|string $value:
string $ref:
Return value
int
1 call to ExifPHPExtension::_exif_reformat_DMS2D()
- ExifPHPExtension::_reformat in ./
ExifPHPExtension.php - Helper function to reformat fields where required.
File
-
./
ExifPHPExtension.php, line 267
Class
- ExifPHPExtension
- This is a helper class to handle the whole data processing of exif.
Namespace
Drupal\exifCode
public function _exif_reformat_DMS2D($value, $ref) {
if (!is_array($value)) {
$value = array(
$value,
);
}
$dec = 0;
$granularity = 0;
foreach ($value as $element) {
$parts = explode('/', $element);
$dec += (double) ((double) $parts[0] / (double) $parts[1] / pow(60, $granularity));
$granularity++;
}
if ($ref == 'S' || $ref == 'W') {
$dec *= -1;
}
return $dec;
}