exif_read_data
Reads the EXIF headers from an image file.
exif_read_data Function synopsis
exif_read_data(
$file,
?string $required_sections = null,
bool $as_arrays = false,
bool $read_thumbnail = false
): array|false
Parameters
$file
The location of the image file. This can either be a path to the file
(stream wrappers are also supported as usual)
or a stream resource.
$required_sections
OptionalType?stringDefault valuenull
Is a comma separated list of sections that need to be present in file
to produce a result array. If none of the requested
sections could be found the return value is false.
$required_sections accepts one of the following string values:
FILECOMPUTEDANY_TAGIFD0THUMBNAILCOMMENTEXIF
$as_arrays
OptionalTypeboolDefault valuefalse
Specifies whether or not each section becomes an array. The
$required_sections COMPUTED,
THUMBNAIL, and COMMENT
always become arrays as they may contain values whose names conflict
with other sections.
$read_thumbnail
OptionalTypeboolDefault valuefalse
When set to true the thumbnail itself is read. Otherwise, only the
tagged data is read.
Return value
Typearray|false
It returns an associative array where the array indexes are
the header names and the array values are the values associated with
those headers. If no data can be returned,
exif_read_data will return false.
Changes to the exif_read_data Function
PHP 8.0
- Return type added:
array|false - Parameter name of parameter #1 changed:
$filenameto$file - Parameter name of parameter #2 changed:
$sections_neededto$required_sections - Parameter type added for parameter #2 (
$required_sections):?string - Parameter default value added for position #2 (
$required_sections):null - Parameter name of parameter #3 changed:
$sub_arraysto$as_arrays - Parameter type added for parameter #3 (
$as_arrays):bool - Parameter default value added for position #3 (
$as_arrays):false - Parameter type added for parameter #4 (
$read_thumbnail):bool - Parameter default value added for position #4 (
$read_thumbnail):false
exif_read_data(
- $filename,
+ $file,
- $sections_needed,
+ ?string $required_sections = null,
- $sub_arrays,
+ bool $as_arrays = false,
- $read_thumbnail
+ bool $read_thumbnail = false
- )
+ ): array|false exif_read_data Function Availability
exif_read_data Function Availability| PHP Version | Availability |
|---|---|
| PHP 8.6Future Release | Yes |
| PHP 8.5Upcoming Release | Yes |
| PHP 8.4Supported (Latest) | Yes |
| PHP 8.3Supported | Yes |
| PHP 8.2Security-Fixes Only | Yes |
| PHP 8.1Security-Fixes Only | Yes |
| PHP 8.0Unsupported | Yes |
| PHP 7.4Unsupported | Yes |
| PHP 7.3Unsupported | Yes |
| PHP 7.2Unsupported | Yes |
| PHP 7.1Unsupported | Yes |
| PHP 7.0Unsupported | Yes |
| PHP 5.6Unsupported | Yes |
| PHP 5.5Unsupported | Yes |
| PHP 5.4Unsupported | Yes |
| PHP 5.3Unsupported | Yes |