/** * @depends testWrite */ function testWriteMetadata($doc) { $meta = new MLPHP\Metadata(parent::$client); $meta->setQuality(1); $doc->writeMetadata($meta); $response = $doc->getResponse(); $this->assertEquals(204, $response->getHttpCode()); return $doc; }
// Load files foreach ($_FILES['upload']['error'] as $key => $error) { if ($error == UPLOAD_ERR_OK) { // Move file to upload directory $tmpName = $_FILES['upload']['tmp_name'][$key]; $name = $_FILES['upload']['name'][$key]; $dest = $mlphp->getConfig()['uploads_dir'] . '/' . $name; move_uploaded_file($tmpName, $dest); try { // Write image file require_once 'IPhoneImageDocument.php'; $image = new IPhoneImageDocument($client); $image->setContentFile($dest); $image->write($name); // Write image metadata $metadata = new MLPHP\Metadata(); $metadata->addProperties(array('latitude' => $image->getLatitude(), 'longitude' => $image->getLongitude(), 'height' => $image->getHeight(), 'width' => $image->getWidth(), 'filename' => $image->getFilename())); $image->writeMetadata($metadata); } catch (Exception $e) { echo 'Error: ' . $e->getMessage(); } } } } catch (Exception $e) { echo $e->getMessage() . ' in ' . $e->getFile() . ' on line ' . $e->getLine() . PHP_EOL; } } // Get search results $search = new MLPHP\Search($client); $params = array('pageLength' => 1000, 'view' => 'all', 'options' => 'photomap', 'format' => 'xml'); $searchResults = $search->retrieve('', $params);