jockchou/photogps

读取照片的GPS定位信息

dev-master 2016-05-11 06:56 UTC

This package is not auto-updated.

Last update: 2024-09-14 19:04:08 UTC


README

reads the GPS coordinate data from a JPEG or TIFF image file. This way you can GPS data generated by digital cameras.

Dependecies

  • PHP >= 4.2.0
  • php_mbstring
  • php_exif

1. Installing

Easy install via composer. Still no idea what composer is? Inform yourself here.

{
  "require": {
    "jockchou/photogps": "*"
  }
}

2. Usage

require_once(__DIR__ . '/../vendor/autoload.php');

$pg = new \PhotoGps\PhotoGps(__DIR__ . "/../test-1.jpg");

var_dump($pg->coordinate());
/*
array(2) {
  ["longitude"]=>
  float(113.92439166667)
  ["latitude"]=>
  float(22.529294444444)
}
*/

//when photo has no gps info
$pg->setFilename(__DIR__ . "/../test-2.jpg");

var_dump($pg->coordinate()); //bool(false)

3. License

jockchou/photogps is freely distributable under the terms of the MIT license.

Copyright (c) 2016 jockchou (jockchou@qq.com)