PHP | read_exif_data() Function Last Updated : 19 Feb, 2020 Comments Improve Suggest changes Like Article Like Report 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 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 read_exif_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 = read_exif_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("THIS IS MY COMMENT"); // 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 = read_exif_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] => THIS IS MY COMMENT ) Reference: https://www.php.net/manual/en/function.read-exif-data.php Comment More infoAdvertise with us Next Article PHP | read_exif_data() Function gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-image-functions Similar Reads PHP | exif_read_data() Function 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 bel 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 | 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 | zip_read() Function The zip_read() function is an inbuilt function in PHP which is used to read an entity present in the opened zip archive. The zip resource is to be read and sent as parameters to the zip_read() function and it returns a resource containing file within the zip archive on success, or FALSE if there is 2 min read PHP | stream_get_meta_data() Function The stream_get_meta_data() function is an inbuilt function in PHP which is used to get the header or meta data from the streams/file pointers.Syntax: array stream_get_meta_data( $stream ) Parameters: The function accepts single parameter $stream, which specifies the meta data to be retrieve and whic 2 min read PHP | dir() Function The dir() function in PHP is an inbuilt function which is used to return an instance of the Directory class. The dir() function is used to read a directory, which includes the following: The given directory is opened. The two properties handle and path of dir() are available. Both handle and path pr 2 min read PHP | fstat( ) Function The fstat() function in PHP is an inbuilt function which is used to return information about an open file. The file name is sent as a parameter to the fstat() function and it returns an array with the following elements : Numeric Associative Description 0 dev Device number 1 ino inode number* 2 mode 3 min read PHP | is_readable( ) Function The is_readable() function in PHP used to check whether the specified file exists and is readable or not. The name of the file is sent as a parameter to the is_readable() function and it returns True if the file exists and is readable. is_readable() function returns False for streams, for example, p 2 min read PHP finfo_file() Function The finfo_file() function is an inbuilt function in PHP that is used for getting information about a file. Syntax: Procedural Style: public finfo_file( string $filename, int $flags = FILEINFO_NONE, ?resource $context = null ): string|false Object-Oriented Style: public finfo::file( string $filename, 2 min read Like