function _video_aspect_ratio in Video 6.4
Same name and namespace in other branches
- 6.5 video.module \_video_aspect_ratio()
- 7.2 video.field.inc \_video_aspect_ratio()
- 7 video.module \_video_aspect_ratio()
Returns the width/height and aspect ratio of the video
@todo: move this to the transcoder class instead?
2 calls to _video_aspect_ratio()
- video_ffmpeg::dimensions in transcoders/
video_ffmpeg.inc - _video_dimensions_options in ./
video_widget.inc - Function updates our options list to show matching aspect ratios and if we have a matching resolution.
File
- ./
video.module, line 378 - video.module
Code
function _video_aspect_ratio($video) {
//lets get our video dimensions from the file
module_load_include('inc', 'video', '/includes/transcoder');
$transcoder = new video_transcoder();
$wxh = $transcoder
->get_dimensions($video);
if (empty($wxh) || empty($wxh['width']) || empty($wxh['height'])) {
// No width and height found. This may be because the transcoder does not support retrieving dimensions.
return null;
}
return array(
'width' => $wxh['width'],
'height' => $wxh['height'],
'ratio' => number_format($wxh['width'] / $wxh['height'], 4),
);
}