Collections functions
Encryption functions
General functions
Theme permission functions
Resource functions

get_video_snapshots()

Description

Check whether a resource (of a video type) has any snapshots created.
Snapshots are being created using config option $ffmpeg_snapshot_frames


@global array $get_resource_path_extra_download_query_string_params Array of query string params
as expected by generateURL()

Parameters

ColumnTypeDefaultDescription
$resource_id integer Resource unique ref
$file_path boolean false Specify whether the return value should be the file path. Default is FALSE
$count_only boolean false Set to true if we are only interested in how many snapshots we have. Default is FALSE

Return

array|integer Array of all file paths found or number of files found

Location

include/resource_functions.php lines 5765 to 5797

Definition

 
function get_video_snapshots($resource_id$file_path false$count_only false)
    {
    global 
$get_resource_path_extra_download_query_string_params$hide_real_filepath;

    
$snapshots_found = array();
 
    
$template_path            get_resource_path($resource_idtrue,  'snapshot'false'jpg', -11false'');
    
$template_webpath         get_resource_path($resource_idfalse'snapshot'false'jpg', -11false'');

    
$i 1;
    do
        {
    
$path=str_replace("snapshot","snapshot_" $i,$template_path);
    if(
$hide_real_filepath){
        
$webpath=$template_webpath "&snapshot_frame=" $i;
    }
    else{
        
$webpath=str_replace("snapshot","snapshot_" $i,$template_webpath);
    }

        
$snapshot_found  file_exists($path);

        if(
$snapshot_found)
            {
            
$snapshots_found[$i] = ($file_path $path $webpath);
            }

        
$i++;
        }
    while(
true === $snapshot_found);

    return (!
$count_only $snapshots_found count($snapshots_found));
    }

This article was last updated 10th July 2020 00:05 Europe/London time based on the source file dated 8th July 2020 11:40 Europe/London time.