You are here

function _video_dimensions_options in Video 7

Same name and namespace in other branches
  1. 6.5 video_widget.inc \_video_dimensions_options()
  2. 6.4 video_widget.inc \_video_dimensions_options()
  3. 7.2 video.field.inc \_video_dimensions_options()
1 call to _video_dimensions_options()
video_widget_element_settings in ./video.module
Process elements loads on settings

File

./video.module, line 423

Code

function _video_dimensions_options(&$options, $video) {
  $aspect_ratio = _video_aspect_ratio($video);

  //loop through our options and find matching ratio's and also the exact width/height
  foreach ($options as $key => $value) {
    $wxh = explode('x', $value);

    //lets check our width and height first
    if ($aspect_ratio['width'] == $wxh[0] && $aspect_ratio['height'] == $wxh[1]) {
      $options[$key] = $value . ' ' . t('(Matches Resolution)');
    }
    else {

      //now lets check our ratio's
      $ratio = number_format($wxh[0] / $wxh[1], 4);
      if ($ratio == $aspect_ratio['ratio']) {
        $options[$key] = $value . ' ' . t('(Matches Ratio)');
      }
    }
  }
  return $aspect_ratio;
}