Skip to main content

Working with Image Metadata in PHP

Sometimes you want to extract the descriptive information embedded in an image, such as the metadata or thumbnails placed in digital photos. For this, you can use PHP’s Exchangeable Image File Format (EXIF) functions. EXIF is a standard for storing descriptive metadata in image files, particularly JPEG and TIFF files.

PHP’s exif_read_data() function can read these headers and extract the information stored within them. below is an example code which extract the information embed in an image.
$DIR = “C:/Users/laeeq/Pictures/”;
$filelist = glob(“$DIR/*.jpg”);
if(sizeof($filelist)>0) {
foreach($filelist as $file) {
$exif = exif_read_data($file, 0, true);
echo “File: $file \n”;
foreach($exif as $section => $data) {
foreach($data as $key => $value) {
echo “$section -> $key = $value \n”;
echo “\n”;


One thought on “Working with Image Metadata in PHP

Leave a Reply

Your email address will not be published. Required fields are marked *


Subscribe For Latest Updates

Signup for our newsletter and get notified when we publish new articles for free!