Collections functions
Encryption functions
General functions
Render functions
Theme permission functions
Video 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 4924 to 4942

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 (
        
$resource['file_extension']=="wav" && 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 23rd April 2021 00:05 Europe/London time based on the source file dated 15th April 2021 09:35 Europe/London time.