function theme_getid3_duration in getID3() 7
Same name and namespace in other branches
- 7.2 getid3.module \theme_getid3_duration()
Format a float duration into minutes:seconds.
Parameters
$variables: Array with 'duration' key.
2 theme calls to theme_getid3_duration()
- getid3_handler_field_duration::render in includes/
getid3_handler_field_duration.inc - Render the field.
- getid3_tokens in ./
getid3.tokens.inc - Implements hook_tokens().
File
- ./
getid3.module, line 251
Code
function theme_getid3_duration($variables) {
$duration = $variables['duration'];
$seconds = round(($duration / 60 - floor($duration / 60)) * 60);
$minutes = floor($duration / 60);
if ($seconds >= 60) {
$seconds -= 60;
$minutes++;
}
return (int) $minutes . ':' . str_pad($seconds, 2, 0, STR_PAD_LEFT);
}