Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
PHP – exif_read_data() function
The exif_read_data() function in PHP reads the EXIF (Exchangeable image file format) headers from an image file. This function extracts all the EXIF headers from an image file.
Syntax
Array exif_read_data( str $file, str $section=null, bool $arrays=false, bool $thumbnail=false )
Parameters
exif_read_data() accepts the following four parameters −
$file − This parameter is used to specify the location of an image file.
$section − This parameter specifies a comma-separated list of sections that need to be present in the file to produce a resultant array.
$arrays − This parameter specifies whether or not to present each section as an array.
$thumbnail − This parameter specifies whether to read the thumbnails or not.
Return Values
The exif_read_data() function returns an associative array on success; False on failure.
Example
<?php
//load an image from local drive
$arrays = exif_read_data('C:\xampp\htdocs\test\research.jpg');
//Output
print_r($arrays);
?>
Here we have used the following image −

Output
It will produce the following output −
Array
(
[FileName] => research.jpg
[FileDateTime] => 1627296139
[FileSize] => 45686
[FileType] => 2
[MimeType] => image/jpeg
[SectionsFound] =>
[COMPUTED] => Array
(
[html] => width="640" height="358"
[Height] => 358
[Width] => 640
[IsColor] => 1
)
)