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

Location

include/render_functions.php lines 5218 to 5240

Definition

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

// 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)
        {
        
?>
        <tr class="DownloadDBlend">
            <td class="DownloadFileName">
                <h2> echo escape($lang['mp3_preview_file']); ?></h2>
                <p> echo formatfilesize(filesize_unlimited($path)); ?></p>
            </td>
             add_download_column($ref,$size_infotrue); ?>
        </tr>
        
        
}   
}

This article was last updated 26th July 2024 21:35 Europe/London time based on the source file dated 24th July 2024 12:25 Europe/London time.