Oct
23
2011

Reading images exif data with PHP

In most photos from digital cameras besides the actual image, there’s a little ”information block” call EXIF data. If you have the correct PHP extension installed on your server – the one called ”exif” – it’s pretty easy to read the EXIF data and display them, as you like.

1) Check if the extension is available?


$load_extensions = get_loaded_extensions();
if (!in_array(exif, $load_extensions )) {
echo "Exif is NOT available";
} else {
echo "Exif extension is available.";
};



other way is simple:


if (function_exists('exif_read_data')) { ... }



2) If you have the extension available, reading the data is a simple matter:


function get__exif__information($file) {
$exif = exif_read_data($file, 0, true);
return $exif;
}

get__exif__information ( path_to_image)


About the Author: SGH

At the same time, I can’t think of anything more satisfying than sitting in front of TV, eating take-away, lights down low, in my pyjamas and watching crap on TV. Basically, I strive to live a balanced life. Fun. Serious. Fast. Slow. Brainy. Bimbotic. Intense. Lazy. You get the drift.

Leave a comment

Click to refresh

Subscribe to newsletter

Sign up with your email to get updates about new resources releases and special offers.