Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/easygithdev/imgmeta

Wrapper to access Exif and IPTC data from an image
https://github.com/easygithdev/imgmeta

Last synced: 21 days ago
JSON representation

Wrapper to access Exif and IPTC data from an image

Awesome Lists containing this project

README

        

# ImgMeta

Wrapper to access Exif and IPTC data from an image.

### Installing

Installation is quite typical - with composer:

```
composer require easygithdev/imgmeta
```

## How to use

Include the autoload, if you need.

```
read($stream)->getMetas();
```

Fetching the EXIF or IPTC tags :

```
$imgData->read($stream)->getExif()->fetch(ExifTags::Copyright);
$imgData->read($stream)->getIptc()->fetch(IptcTags::City);
```

Or you can use the quick acces :
```
(new ImgData())->read($stream)->exif('Copyright');
(new ImgData())->read($stream)->iptc('City');
```

### Working with EXIF only

Get all the datas :

```
$imgData = new ImgData();
$exifManager = $imgData->createExifManager();
$exifManager->read(ExifReader::getReader($stream));
$exifManager->getMetas();
```

Fetch one tag :

```
$exifManager->fetch(ExifTags::Copyright);
```

Or :

```
$exifManager->fetch('Copyright');
```

For example to fetch the GPS informations :

```
$latitude = $exifManager->fetch('GPSLatitude');
$longitude = $exifManager->fetch('GPSLongitude');
```

Using helper to get the GPS infos :

```
$exifManager->getPosition();
```

### Working with IPTC only

```
$imgData = new ImgData();
$iptcManager = $imgData->createIptcManager();
$iptcManager->read(IptcReader::getReader($stream));
```

Get IPTC default format :

```
$iptcManager->getMetas();
```

Get IPTC by Key :

```
$iptcManager->getMetasByKey();
```

Get IPTC by Name :

```
$iptcManager->getMetasByName();
```

Get IPTC by name with all keys :

```
$iptcManager->getAssocMetas(IptcManager::META_BY_NAME, true);
```

Fetch one tag, datas are flatten :

```
$iptcManager->fetch(IptcTags::Country_PrimaryLocationName);
```

Fetch one tag, datas are originals :

```
$iptcManager->fetchAll(IptcTags::Country_PrimaryLocationName);
```

## License

This project is licensed under GNU license - see the [LICENSE](LICENSE) file for deta