You are here

function _video_aspect_ratio in Video 7

Same name and namespace in other branches
  1. 6.5 video.module \_video_aspect_ratio()
  2. 6.4 video.module \_video_aspect_ratio()
  3. 7.2 video.field.inc \_video_aspect_ratio()
3 calls to _video_aspect_ratio()
video_ffmpeg::dimensions in transcoders/video_ffmpeg.inc
video_phpvideotoolkit::dimensions in transcoders/video_phpvideotoolkit.inc
_video_dimensions_options in ./video.module

File

./video.module, line 449

Code

function _video_aspect_ratio($video) {

  //lets get our video dimensions from the file
  $transcoder = new video_transcoder();
  $wxh = $transcoder
    ->get_dimensions($video);
  $width = $wxh['width'];
  $height = $wxh['height'];
  if (!$width || !$height) {

    //no width and height found just return.
    watchdog('video_conversion', 'We could not determine the height and width of the video: ' . $video, array(), WATCHDOG_DEBUG);

    //    drupal_set_message(t('The system counld not determine the width and height of your video: !video.  If transcoding, the system could have problems.', array('!video' => $video)));
    return;
  }

  //now lets get aspect ratio and compare our options in the select dropdown then add an asterick if any to each option representing a matching aspect ratio.
  $ratio = number_format($width / $height, 4);
  $aspect_ratio = array(
    'width' => $width,
    'height' => $height,
    'ratio' => $ratio,
  );
  return $aspect_ratio;
}