All pastes #174317 Raw Edit

Miscellany

public text v1 · immutable
·published 2006-09-17 20:21 UTC
rendered paste body
exif_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;
}

?>