PHP | exif_read_data() Function Last Updated : 19 Feb, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report The exif_read_data() function is an inbuilt function in PHP which is used to read the EXIF headers from an image file. Syntax: array exif_read_data( mixed $stream, string $sections, bool $arrays, bool $thumbnail ) Parameters: This function accepts four parameters as mentioned above and described below: $stream: It specifies the image file. $sections (Optional): It specifies the comma separated list of sections. $arrays (Optional): It specifies whether not to present each section as array. $thumbnail (Optional): It specifies whether to read thumbnail or not. Return Value: This function returns an associative array on success or FALSE on failure. Below examples illustrate the exif_read_data() function in PHP: Example 1: php <?php // Open a the file from local folder $fp = fopen('./geeksforgeeks.jpg', 'rb'); // Read the exif headers $headers = exif_read_data($fp); // Print the headers echo 'EXIF Headers:' . '<br>'; print("<pre>".print_r($headers, true)."</pre>"); ?> Output: EXIF Headers: Array ( [FileName] => geeksforgeeks.jpg [FileDateTime] => 1580889002 [FileSize] => 17763 [FileType] => 2 [MimeType] => image/jpeg [SectionsFound] => [COMPUTED] => Array ( [html][/html] => width="667" height="184" [Height] => 184 [Width] => 667 [IsColor] => 1 ) ) Example 2: php <?php // Create an Imagick Object $image = new Imagick( 'https://media.geeksforgeeks.org/wp-content/uploads/20200123100652/geeksforgeeks12.jpg'); // Add comment to the image $image->commentImage("GeeksforGeeks"); // Save the file to local image $image->writeImage('geeksforgeeks.jpg'); // Open a the same file $fp = fopen('./geeksforgeeks.jpg', 'rb'); // Read the exif headers $headers = exif_read_data($fp, 'COMMENT', true, true); // Print the headers echo 'EXIF Headers:' . '<br>'; print("<pre>".print_r($headers['COMMENT'], true)."</pre>"); ?> Output: EXIF Headers: Array ( [0] => GeeksforGeeks ) Reference: https://www.php.net/manual/en/function.exif-read-data.php Comment More infoAdvertise with us Next Article PHP | readdir() Function G gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-image-functions Similar Reads PHP | read_exif_data() Function The read_exif_data() function is an inbuilt function in PHP which is used to read the EXIF headers from an image file and is an alternate for exif_read_data(). Syntax: array read_exif_data( mixed $stream, string $sections, bool $arrays, bool $thumbnail ) Parameters: This function accepts four parame 2 min read PHP | exif_tagname() Function The exif_tagname() function is an inbuilt function in PHP which is used to get the header name for an index. Syntax: string exif_tagname( int $index ) Parameters: This function accepts a single parameter $index which holds the header name. Return Value: This function returns the name of header on su 2 min read PHP | readdir() Function The readdir() function in PHP is an inbuilt function which is used to return the name of the next entry in a directory. The method returns the filenames in the order as they are stored in the filenamesystem. The directory handle is sent as a parameter to the readdir() function and it returns the ent 2 min read PHP | readdir() Function The readdir() function in PHP is an inbuilt function which is used to return the name of the next entry in a directory. The method returns the filenames in the order as they are stored in the filenamesystem. The directory handle is sent as a parameter to the readdir() function and it returns the ent 2 min read PHP readfile( ) Function The readfile() function in PHP reads a file and writes its contents directly to the output buffer (usually the browser). Itâs an easy way to show a file without reading it line by line yourself.If thereâs a problem reading the file, like if it doesnât exist, PHP will usually show an error message. T 3 min read PHP readfile( ) Function The readfile() function in PHP reads a file and writes its contents directly to the output buffer (usually the browser). Itâs an easy way to show a file without reading it line by line yourself.If thereâs a problem reading the file, like if it doesnât exist, PHP will usually show an error message. T 3 min read Like