Collections functions
General functions
Node functions
Render functions
Theme permission functions
User functions
Resource functions

render_audio_download_link()

Description

add link to mp3 preview file if resource is a wav file

Parameters

ColumnTypeDefaultDescription
$resource array - resource data
$ref int - resource ref
$k string - url param key
$ffmpeg_audio_extensions array - config var containing a list of extensions which will be ported to mp3 format for preview
$baseurl string - config base url
$lang array - array containing language strings
$use_larger_layout boolean - should the page use a larger resource preview layout?

Location

include/render_functions.php lines 5215 to 5232

Definition

 
function render_audio_download_link($resource$ref$k$ffmpeg_audio_extensions$baseurl$lang$use_larger_layout)
{

// if resource is a .wav file and user has permissions to download then allow user also to download the mp3 preview file if available
// resources with extension in $ffmpeg_audio_extensions will always create an mp3 preview file 
    
    
$path                       get_resource_path($resource['ref'],true,"",false,"mp3");
    
$resource_download_allowed  resource_download_allowed($ref,'',$resource["resource_type"]);
    
$size_info                  = array('id' => '''extension' => 'mp3');

    if (
in_array($resource['file_extension'], $ffmpeg_audio_extensions) && file_exists($path) && $resource_download_allowed)
        {
        
$colspan $use_larger_layout ' colspan="2"' '';
        echo 
"<tr class=\"DownloadDBlend\"><td class=\"DownloadFileName\" $colspan><h2>" $lang['mp3_preview_file'] . "</h2></td><td class=\"DownloadFileSize\">" formatfilesize(filesize_unlimited($path)) . "</td>" 
        
add_download_column($ref,$size_infotrue);
        echo 
"</tr>";
        }   
}

This article was last updated 19th March 2024 04:05 Europe/London time based on the source file dated 15th March 2024 17:00 Europe/London time.