Пример #1
0
 public function testCanSetAndGetOriginalChecksums()
 {
     $this->assertSame(array(), $this->query->originalChecksums());
     $this->assertSame($this->query, $this->query->originalChecksums(array('checksum1', 'checksum2')));
     $this->assertSame(array('checksum1', 'checksum2'), $this->query->originalChecksums());
 }
Пример #2
0
 /**
  * Checks if a given image exists on the server already by specifying a local path
  *
  * @param string $path Path to the local image
  * @throws InvalidArgumentException Throws an exception if the specified file does not exist or
  *                                  is of zero length
  * @return boolean
  */
 public function imageExists($path)
 {
     $this->validateLocalFile($path);
     $checksum = md5_file($path);
     $query = new ImagesQuery();
     $query->originalChecksums(array($checksum))->limit(1);
     $response = $this->getImages($query);
     return (bool) $response['search']['hits'];
 }