function _video_scale_video in Video 6.2
Same name and namespace in other branches
- 5 video.module \_video_scale_video()
- 6 video.module \_video_scale_video()
Scale a video to match the desired width
1 call to _video_scale_video()
- theme_video_player in ./
video.module - theme function to control which player is presented
File
- ./
video.module, line 1542 - video.module
Code
function _video_scale_video(&$node) {
$def_width = (int) variable_get("video_resolution_width", 400);
if ($def_width <= 0) {
// video scaling has been disabled
if (!$node->videox || !$node->videoy) {
// we shouldn't have videox or videoy null.. but this is just in case for safety
$node->video_scaled_x = 400;
$node->video_scaled_y = 300;
}
else {
$node->video_scaled_x = $node->videox;
$node->video_scaled_y = $node->videoy;
}
return;
}
if (!$node->videox || !$node->videoy) {
// we shouldn't have videox or videoy null.. but this is just in case for safety
$height = $def_width * 3 / 4;
}
else {
$height = $def_width * ($node->videoy / $node->videox);
// do you remember proportions?? :-)
}
$height = round($height);
// add one if odd
if ($height % 2) {
$height++;
}
$node->video_scaled_x = $def_width;
$node->video_scaled_y = $height;
}