> For the complete documentation index, see [llms.txt](https://knowledgebase.ajaxsearchpro.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://knowledgebase.ajaxsearchpro.com/miscellaneous/files-and-media/searching-image-exif-metadata.md).

# Searching Image EXIF metadata

Indexing image metadata with Ajax Search Pro

### Prerequesites

* [File Content Search ](https://documentation.ajaxsearchpro.com/general-settings/search-in-attachment-contents-pdf-word-excel-etc..)Enabled

The snippet below will hook into the index process and read the file EXIF metadata to append to the indexed image files. It works for all image mime types.

[What is this, and where do I put this custom code?](/safe-coding-guideline.md)

```php
add_filter( 'asp_index_file_custom_parse', function ( $contents, $the_post ) {
	if ( wp_attachment_is_image($the_post) ) {
		$file_path = get_attached_file($the_post->ID);
		$data = wp_read_image_metadata($file_path);
		if ( is_array($data) ) {
			$data = array_filter($data, fn($s)=>!empty($s));
			$contents = implode(', ', $data);
		}
	}

	return $contents;
}, 10, 2);
```
