Exemple #1
0
 public static function castImageExif(Image\Exif $exif, array $a, Stub $stub, $isNested, $filter = 0)
 {
     $a = $a[Caster::PREFIX_PROTECTED . 'data'];
     $a[Caster::PREFIX_VIRTUAL . 'aspectRatio'] = $exif->getAspectRatio();
     $a[Caster::PREFIX_VIRTUAL . 'latitude'] = $exif->getLatitude();
     $a[Caster::PREFIX_VIRTUAL . 'longitude'] = $exif->getLongitude();
     return $a;
 }
Exemple #2
0
 /**
  * Returns the aspect ratio.
  *
  * @return float
  */
 public function getAspectRatio()
 {
     if ($this->getWidth() === 0 || $this->getHeight() === 0) {
         return 0.0;
     }
     // Account for image rotation
     if (in_array($this->exif->getOrientation(), [5, 6, 7, 8])) {
         return $this->getHeight() / $this->getWidth();
     }
     return $this->getWidth() / $this->getHeight();
 }
Exemple #3
0
 /**
  * {@inheritdoc}
  */
 public function jsonSerialize()
 {
     return ['dims' => [$this->dimensions->getWidth(), $this->dimensions->getHeight()], 'type' => $this->type->getId(), 'bits' => $this->bits, 'channels' => $this->channels, 'mime' => $this->mime, 'exif' => $this->exif->getData()];
 }
Exemple #4
0
 public function testGetLongitude()
 {
     $exif = new Exif([Exif::GPS => '35.25513,149.1093073']);
     $this->assertSame(149.1093073, $exif->getLongitude());
 }