Пример #1
0
 /**
  * @covers \MediaVorus\Media\Image::getHeight
  * @covers \MediaVorus\Media\Image::extractFromDimensions
  */
 public function testGetHeight()
 {
     $this->assertTrue(is_int($this->object->getHeight()));
     $this->assertEquals(8, $this->object->getHeight());
     $objects = $this->mediavorus->inspectDirectory(__DIR__ . '/../../../files/');
     foreach ($objects as $object) {
         if ($object->getType() == MediaInterface::TYPE_IMAGE) {
             if (in_array($object->getFile()->getFilename(), array('KyoceraRaw.raw', 'Font.dfont', 'XMP.svg'))) {
                 $this->assertNull($object->getHeight());
             } else {
                 $this->assertTrue(is_int($object->getHeight()), $object->getFile()->getFilename() . " has int width");
             }
         }
     }
 }
Пример #2
0
 /**
  * @VirtualProperty
  *
  * @return Integer
  */
 public function getHeight()
 {
     $height = parent::getHeight();
     if (null === $this->ffprobe) {
         return $height;
     }
     try {
         $video = $this->ffprobe->streams($this->file->getPathname())->videos()->first();
         return $video->getDimensions()->getHeight();
     } catch (FFMpegException $e) {
     }
     return $height;
 }
Пример #3
0
 /**
  * @VirtualProperty
  *
  * @return Integer
  */
 public function getHeight()
 {
     if (null !== ($result = parent::getHeight())) {
         return $result;
     }
     if (null === $this->ffprobe) {
         return null;
     }
     try {
         $video = $this->ffprobe->streams($this->file->getPathname())->videos()->first();
         if ($video->has('height')) {
             return (int) $video->get('height');
         }
     } catch (FFMpegException $e) {
     }
     return null;
 }