<?
$x = Array
(
'FILE' => Array
(
'FileName' => 'f-20110129_004_pp.jpg',
'FileDateTime' => 0,
'FileSize' => 3566966,
'FileType' => 2,
'MimeType' => 'image/jpeg',
'SectionsFound' => 'ANY_TAG, IFD0, THUMBNAIL, EXIF, GPS',
),
'COMPUTED' => Array
(
'html' => 'width="2576" height="1936"',
'Height' => 1936,
'Width' => 2576,
'IsColor' => 1,
'ByteOrderMotorola' => 0,
'ApertureFNumber' => 'f/2.8',
'Thumbnail.FileType' => 2,
'Thumbnail.MimeType' => 'image/jpeg',
),
'IFD0' => Array
(
'ImageWidth' => 2576,
'ImageLength' => 1936,
'BitsPerSample' => Array
(
'0' => 8,
'1' => 8,
'2' => 8,
),
'Make' => 'Nokia',
'Model' => 'N900',
'Orientation' => 1,
'SamplesPerPixel' => 3,
'XResolution' => '3000000/10000',
'YResolution' => '3000000/10000',
'ResolutionUnit' => 2,
'Software' => 'Adobe Photoshop CS5 Windows',
'DateTime' => '2011:01:29 09:37:30',
'YCbCrPositioning' => 1,
'Exif_IFD_Pointer' => 276,
'GPS_IFD_Pointer' => 658,
),
'THUMBNAIL' => Array
(
'Compression' => 6,
'XResolution' => '72/1',
'YResolution' => '72/1',
'ResolutionUnit' => 2,
'JPEGInterchangeFormat' => 978,
'JPEGInterchangeFormatLength' => 5525,
),
'EXIF' => Array
(
'ExposureTime' => '1/500',
'FNumber' => '14/5',
'ExposureProgram' => 0,
'ISOSpeedRatings' => 100,
'ExifVersion' => '0210',
'DateTimeOriginal' => '2011:01:29 09:37:30',
'DateTimeDigitized' => '2011:01:29 09:37:30',
'ShutterSpeedValue' => '8/1',
'ApertureValue' => '297/100',
'LightSource' => 0,
'Flash' => 0,
'FocalLength' => '26/5',
'FlashPixVersion' => '0100',
'ColorSpace' => 1,
'ExifImageWidth' => 2576,
'ExifImageLength' => 1936,
'CustomRendered' => 0,
'ExposureMode' => 0,
'WhiteBalance' => 0,
'DigitalZoomRatio' => '1/1',
'SceneCaptureType' => 0,
'GainControl' => 0,
'Contrast' => 0,
'Saturation' => 0,
),
'GPS' => Array
(
'GPSVersion' => '',
'GPSLatitudeRef' => 'N',
'GPSLatitude' => Array
(
'0' => '22/1',
'1' => '12937/1000',
'2' => '0/1',
),
'GPSLongitudeRef' => 'E',
'GPSLongitude' => Array
(
'0' => '113/1',
'1' => '32886/1000',
'2' => '0/1',
),
'GPSAltitudeRef' => '',
'GPSAltitude' => '255/1',
'GPSTimeStamp' => Array
(
'0' => '9/1',
'1' => '37/1',
'2' => '30/1',
),
'GPSMapDatum' => 'WGS-84',
'GPSDateStamp' => '2011:01:29',
),
);
function get_values( $data, $keys ) {
$ret = Array();
foreach( $data as $k => $v ) {
if( is_array( $v ) ) {
$t = get_values( $v, $keys );
if( is_array( $t ) && sizeOf( $t ) > 0 ) {
$ret[$k] = $t;
}
} else {
if( in_array( $k, $keys ) ) {
$ret[ $k ] = $v;
}
}
}
return $ret;
}
print_r( get_values( $x, Array( 'ImageWidth', 'ImageLength', 'XResolution', 'GPSLatitude' ) ) );
?>