{"id":20469395,"url":"https://github.com/frameright/php-image-metadata-parser","last_synced_at":"2025-04-13T10:34:06.514Z","repository":{"id":61253238,"uuid":"546707562","full_name":"Frameright/php-image-metadata-parser","owner":"Frameright","description":"PHP image metadata parsing library (XMP, IPTC, Exif)","archived":false,"fork":false,"pushed_at":"2024-12-09T19:00:42.000Z","size":11804,"stargazers_count":11,"open_issues_count":5,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T08:19:48.843Z","etag":null,"topics":["frameright","image","image-display-control","image-manipulation","iptc-metadata","metadata","metadata-extraction","metadata-parser"],"latest_commit_sha":null,"homepage":"https://docs.frameright.io/php","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"dchesterton/image","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Frameright.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-06T14:11:56.000Z","updated_at":"2025-01-05T01:46:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"ac139374-c7f6-4431-8abe-7fa234f985d2","html_url":"https://github.com/Frameright/php-image-metadata-parser","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frameright%2Fphp-image-metadata-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frameright%2Fphp-image-metadata-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frameright%2Fphp-image-metadata-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Frameright%2Fphp-image-metadata-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Frameright","download_url":"https://codeload.github.com/Frameright/php-image-metadata-parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248537193,"owners_count":21120711,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["frameright","image","image-display-control","image-manipulation","iptc-metadata","metadata","metadata-extraction","metadata-parser"],"created_at":"2024-11-15T14:08:56.498Z","updated_at":"2025-04-13T10:34:06.492Z","avatar_url":"https://github.com/Frameright.png","language":"PHP","readme":"[![Packagist Version](https://img.shields.io/packagist/v/frameright/image-metadata-parser)](https://packagist.org/packages/frameright/image-metadata-parser)\n\n\u003c!--\nWARNING: Bits of information here are duplicated in several places:\n  * https://docs.frameright.io/php\n  * https://github.com/Frameright/php-image-metadata-parser\nMake sure to keep them in sync.\n--\u003e\n\n# Image metadata parsing library (PHP 5.5+)\n\n\u003e **➡️ See this document rendered at [docs.frameright.io/php](https://docs.frameright.io/php)**\n\n\u003e **NOTE**: this is based on\n\u003e [dchesterton/image](https://github.com/dchesterton/image). Many thanks to\n  [dchesterton](https://github.com/dchesterton)!\n\nSupported image types:\n   - JPEG\n   - PNG\n   - ~~WEBP~~\n\nSupported image meta types:\n   - XMP\n   - IPTC\n   - ~~EXIF~~\n\n\u003e **NOTE**: a TypeScript equivalent of this library is available\n\u003e [here](https://github.com/Frameright/image-display-control-metadata-parser).\n\n## Installation\n\nPull the library in your project  via [Composer](https://getcomposer.org/)\nwith the following `composer.json`:\n\n```json\n{\n  \"minimum-stability\": \"dev\",\n  \"repositories\": [\n    {\n      \"type\": \"vcs\",\n      \"url\": \"https://github.com/Frameright/php-image-metadata-parser.git\"\n    }\n  ],\n  \"require\": {\n    \"frameright/image-metadata-parser\": \"dev-master\"\n  }\n}\n```\n\n**Dependencies**: [`php-xml`](https://www.php.net/manual/en/book.dom.php)\n\n## Usage\n\n\u0026emsp; :sparkles: [Getting started](https://docs.frameright.io/php/getting-started)\n\n\u0026emsp; :wrench: [Contributing](https://docs.frameright.io/php/contributing)\n\n\u0026emsp; :memo: [Tutorial](https://www.frameright.io/post/metadata-in-php)\n\n\u0026emsp; 📝 [Changelog](https://docs.frameright.io/php/changelog)\n\n### Get metadata\n\n```php\n$image = Image::fromFile($filename);\n\n$headline = $image-\u003egetXmp()-\u003egetHeadline();\n$camera = $image-\u003egetExif()-\u003egetCamera();\n...\n```\n\n### Loading specific image type\n\nWhen file type is known, you can load the file type directly using the file types' `fromFile` method.\n\n```php\n$jpeg = JPEG::fromFile('image.jpg');\n$png = PNG::fromFile('image.png');\n```\n\n### Instantiate from bytes\n\nIf you don't have a file to work with but you do have the image stored in a string (from database, ImageMagick etc.) you can easily instantiate an object from the string.\n\n```php\n$data = ...\n\n$jpeg = JPEG::fromString($data);\n```\n\n### Instantiate from GD or a stream\n\nYou can also create an object from a GD resource or a stream.\n\n```php\n$gd = imagecreate(100, 100);\n$jpeg = JPEG::fromResource($gd);\n```\n\n```php\n$stream = fopen('...', 'r+');\n$jpeg = JPEG::fromStream($stream);\n```\n\n### Aggregate metadata\n\nWhen just want a piece of metadata and don't care whether it's from XMP, IPTC or EXIF, you can use the aggregate meta object.\n\n```php\n$image = Image::fromFile($filename);\n$headline = $image-\u003egetAggregate()-\u003egetHeadline();\n```\n\nBy default it checks XMP first, then IPTC, then EXIF but you can change the priority:\n\n```php\n$aggregate = $image-\u003egetAggregate();\n$aggregate-\u003esetPriority(['exif', 'iptc', 'xmp']);\n\n$aggregate-\u003egetHeadline(); // will now check EXIF first, then IPTC, then XMP\n```\n\nYou can also exclude a metadata type if you do not want to use it:\n\n```php\n$aggregate-\u003esetPriority(['iptc', 'xmp']);\n$aggregate-\u003egetHeadline(); // will only check IPTC and XMP\n```\n\n#### Get GPS data\n\n```php\n$image = ...\n$gps = $image-\u003egetAggregateMeta()-\u003egetGPS(); // checks EXIF and XMP\n// or $gps = $image-\u003egetExif()-\u003egetGPS();\n\n$lat = $gps-\u003egetLatitude();\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fframeright%2Fphp-image-metadata-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fframeright%2Fphp-image-metadata-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fframeright%2Fphp-image-metadata-parser/lists"}