Esempio n. 1
0
 /**
  * Get associative array with exif info from a photo
  *
  * @param string $path	Path to the photo.
  * @return array		Exif info in associative array.
  */
 function readExif($path)
 {
     //include and call the exifixer script
     require_once realpath(PHOTOQ_PATH . 'lib/exif/exif.php');
     $fullexif = read_exif_data_raw($path, 0);
     //we now retain only the useful (whatever it means ;-) ) info
     $ifd0 = PhotoQExif::_filterUseless($fullexif['IFD0']);
     $subIfd = PhotoQExif::_filterUseless($fullexif['SubIFD']);
     $makerNote = $subIfd['MakerNote'];
     unset($subIfd['MakerNote']);
     $gps = PhotoQExif::_filterUseless($fullexif['GPS']);
     //bring all the arrays to single dimension
     $ifd0 = PhotoQHelper::flatten($ifd0);
     $subIfd = PhotoQHelper::flatten($subIfd);
     $makerNote = PhotoQHelper::flatten($makerNote);
     $gps = PhotoQHelper::flatten($gps);
     //and finally merge them into a single array
     $exif = array_merge($ifd0, $subIfd, $makerNote, $gps);
     //update discovered tags
     PhotoQExif::_discoverTags($exif);
     return $exif;
 }
Esempio n. 2
0
 /**
  * Reduces multidimensional array to single dimension.
  *
  * @param array $in
  * @return array
  */
 function flatten($in)
 {
     $out = array();
     if (is_array($in)) {
         foreach ($in as $key => $value) {
             if (is_array($value)) {
                 unset($in[$key]);
                 $out = array_merge($out, PhotoQHelper::flatten($value));
             } else {
                 $out[$key] = $value;
             }
         }
     }
     return $out;
 }