public function getAspectRatio() { if (!empty($this->interfaceObj)) { return $this->interfaceObj['width'] / $this->interfaceObj['height']; } return parent::getAspectRatio(); }
/** * Aspect ratio of the video * @return float */ public function getAspectRatio() { if (isset($this->interfaceObj['file_meta']['height'], $this->interfaceObj['file_meta']['width'])) { if ($this->interfaceObj['file_meta']['height'] != 0) { return $this->interfaceObj['file_meta']['width'] / $this->interfaceObj['file_meta']['height']; } } return parent::getAspectRatio(); }
public function getAspectRatio() { wfProfileIn(__METHOD__); $embed_code = $this->interfaceObj['video']['embed_code']; $matches = array(); $width = $height = null; if (preg_match('/width="(\\d+)"/', $embed_code, $matches)) { $width = $matches[1]; $matches = array(); if (preg_match('/height="(\\d+)"/', $embed_code, $matches)) { $height = $matches[1]; } } if ($width && $height) { wfProfileOut(__METHOD__); return $width / $height; } wfProfileOut(__METHOD__); return parent::getAspectRatio(); }