note 52484 deleted from ref.array by aidan
| From: | aidan@php.net | Date: | Sun, 09 Oct 2005 09:13:09 +0000 |
| Subject: | note 52484 deleted from ref.array by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-96731@lists.php.net to get a copy of this message | ||
Note Submitter: freetools at stocklumino dot com
----
Hi
a sample code for storing an exif data in array, and they reading the data by key name.
//call the functions here
$filename = 'C:\myapp\test.jpg';
testreader($filename,'FileSize');
/*
this is function for test
*/
function testreader($filename,$keytofind)
{
$allkeyvalsglobal = array();
$myexif = new exifReader();
$allkeyvalsglobal = $myexif->manageexifreader($filename);
$result = $myexif->readExif($allkeyvalsglobal,$keytofind);
echo "<br>".$keytofind."=".$result;
}
class exifreader
{
function manageexifreader($filename)
{
$allkeys = array();
$keyvalpairs = array();
$allData = read_exif_data ($filename);
while(list($k,$v)=each($allData))
{
echo "$k: $v<br>\n";
array_push($allkeys,$k);
$keyvalpairs[$k] = $v;
}
/* Uncomment this for testing
$foundFileNum = count($allkeys);
for($i=0;$i<$foundFileNum;$i++)
{
$onekey = $allkeys[$i];
echo"<br>".":".$keyvalpairs[$onekey];
}*/
return $keyvalpairs;
}
function getAllExitdata($filename)
{
$exif = read_exif_data ($filename);
}
function readExif($allkeyvalsglobal,$keyname)
{
//global $allkeyvalsglobal;
/* Uncomment this for testing
echo "<br>Got data111 :".$allkeyvalsglobal[$keyname];
*/
return $allkeyvalsglobal[$keyname];
}
}