rendered paste bodyexif_class.php
----------------------------------
<?php
Class Exif_Data {
function Camera_Info($image) {
/*
* $foo = new Exif_Data();
* $bar = $foo->Camera_Info("file.jpg")
* $bar['make'] = camera make
* $bar['model'] = camera model
*
*/
$exif = exif_read_data($image, 'IFD0');
$make = $exif['Make'];
$model = $exif['Model'];
$make = str_replace(" CORPORATION","",$make);
$model = str_replace($make." ","",$model);
if ($exif!=false){
return array("make"=>$make,"model"=>$model);
} else {
return "No EXIF information Available.";
}
}
}
?>
blah.php
----------------------------------------
<?php
require_once("exif_class.php");
$Exif = new Exif_Data();
$camera = $Exif->Camera_Info("/home/tballard/angst.jpg");
if(is_array($camera)) {
echo $camera['make']."<br />".$camera['model'];
} else {
echo $camera;
}
echo "<br /><br />";
$camera = $Exif->Camera_Info("/home/tballard/creek.jpg");
if(is_array($camera)) {
echo $camera['make']."<br />".$camera['model'];
} else {
echo $camera;
}
echo "<br /><br />";
$camera = $Exif->Camera_Info("/home/tballard/img_1368.jpg");
if(is_array($camera)) {
echo $camera['make']."<br />".$camera['model'];
} else {
echo $camera;
}
?>