Speed up development with full-stack environments for every branch.

Learn More

How to read the EXIF headers from JPEG or TIFF with exif_read_data()

Forked from Hello World.

327 Runs 2802 Views 626 Copies
Saved

Saved

gtsolutions 373

gtsolutions
published 4 years ago

<?php

/**
 * PHP exif module
 * Reads the EXIF headers from JPEG or TIFF with exif_read_data()
 * 
 */
//setting the style for the display div
$divStyle = ' background-color:#E8E8E3;
            padding:10px;
            color:#000;
            font-size:16px;
            width:50%;
            overflow:hidden;';

$imagesNames = array(
    'images/image1.jpg',
    'images/image2.jpg'
);
echo '<center>';
foreach ($imagesNames as $image) {

    $exif = exif_read_data($image, COMPUTED, true);
    if($exif){
    echo '<div style = "' . $divStyle . '">
    Info returned by <b>exif_read_data('.$image.', COMPUTED)</b>
    <br /><br />
        <pre>';
    print_r($exif);
    echo '</pre>
        </div>';
    }
    
}
echo '</center>';
?>
Please login/signup to get access to the terminal.

Your session has timed out.

Dismiss (the page may not function properly).