Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test 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 5280 to 5302

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 8th November 2024 14:35 Europe/London time based on the source file dated 7th November 2024 17:40 Europe/London time.