getImageIdentifier() public method

Get the image identifier
public getImageIdentifier ( ) : string
return string
Exemplo n.º 1
0
 /**
  * @covers Imbo\Model\Image::setImageIdentifier
  * @covers Imbo\Model\Image::getImageIdentifier
  */
 public function testCanSetAndGetTheImageIdentifier()
 {
     $this->assertNull($this->image->getImageIdentifier());
     $this->assertSame($this->image, $this->image->setImageIdentifier('identifier'));
     $this->assertSame('identifier', $this->image->getImageIdentifier());
 }
Exemplo n.º 2
0
 /**
  * Fetch POI from metadata for the image
  *
  * @param EventInterface $event
  * @param Image $image
  * @return array|false Array with x and y coordinate, or false if no POI was found
  */
 private function getPoiFromMetadata(EventInterface $event, Image $image)
 {
     $metadata = $event->getDatabase()->getMetadata($image->getUser(), $image->getImageIdentifier());
     $poi = isset($metadata['poi'][0]) ? $metadata['poi'][0] : false;
     // Fetch POI from metadata. Array used if we want to expand with multiple POIs in the future
     if ($poi && isset($poi['cx']) && isset($poi['cy'])) {
         return [(int) $poi['cx'], (int) $poi['cy']];
     } else {
         if ($poi && isset($poi['x']) && isset($poi['y']) && isset($poi['width']) && isset($poi['height'])) {
             return [(int) $poi['x'] + $poi['width'] / 2, (int) $poi['y'] + $poi['height'] / 2];
         }
     }
     return false;
 }
Exemplo n.º 3
0
 /**
  * Fetch POIs from metadata for the image
  *
  * @param EventInterface $event
  * @param Image $image
  * @return array Array with POIs
  */
 private function getPoisFromMetadata(EventInterface $event, Image $image)
 {
     $metadata = $event->getDatabase()->getMetadata($image->getUser(), $image->getImageIdentifier());
     return isset($metadata['poi']) ? $metadata['poi'] : [];
 }