\n"); exit(1); } $dir = $argv[1]; if (!is_dir($dir)) { fwrite(STDERR, "Not a directory: $dir\n"); exit(1); } $it = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS) ); $ok = 0; $bad = 0; $skip = 0; foreach ($it as $f) { if (!$f->isFile()) continue; if (strtolower($f->getExtension()) !== 'png') continue; $stem = pathinfo($f->getFilename(), PATHINFO_FILENAME); $meta = Geoplot_XMP::read($f->getPathname()); if ($meta === null) { printf("SKIP %s (no XMP)\n", $f->getFilename()); $skip++; continue; } $recomputed = Geoplot_Geohash::generate($meta['lat'], $meta['lon'], $meta['date']); if ($recomputed === $stem) { printf("OK %s %s\n", $stem, $recomputed); $ok++; } else { printf("FAIL %s (computed %s)\n", $stem, $recomputed); $bad++; } } printf("\n%d ok, %d fail, %d skipped\n", $ok, $bad, $skip);