Function name: read_exif_data()
Applicable version: PHP 4 >= 4.2.0, PHP 5, PHP 7
Usage: read_exif_data(string $filename, string $sections = NULL, bool $arrays = false, bool $thumbnail = false) : array|false
parameter:
Return value:
Example: <?php $filename = "path/to/image.jpg";
// Read all EXIF data $exifData = read_exif_data($filename); if ($exifData !== false) { echo "EXIF data:"; print_r($exifData); } else { echo "Unable to read EXIF data."; }
// Only read EXIF data for a specific part $sections = "FILE,COMPUTED"; $exifData = read_exif_data($filename, $sections); if ($exifData !== false) { echo "EXIF data for a specified part: "; print_r($exifData); } else { echo "Unable to read EXIF data for a specified part."; }
// Convert multiple values to array$exifData = read_exif_data($filename, NULL, true); if ($exifData !== false) { echo "EXIF data (multiple values are converted to array): "; print_r($exifData); } else { echo "Unable to read EXIF data."; }
// Read the thumbnail of the image $exifData = read_exif_data($filename, NULL, false, true); if ($exifData !== false) { echo "Thumbnail data of the image: "; print_r($exifData); } else { echo "Thumbnail data of the image cannot be read."; } ?>