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

generate_featured_collection_image_urls()

Description

Get preview URLs for a list of resource IDs

Parameters

ColumnTypeDefaultDescription
$resource_refs array List of resources
$size string Preview size

Return

array List of resource refs and corresponding images URLs

Location

include/collections_functions.php lines 3142 to 3173

Definition

 
function generate_featured_collection_image_urls(array $resource_refsstring $size)
    {
    global 
$baseurl;

    
$images = array();

    
$refs_list array_filter($resource_refs'is_numeric');
    if(empty(
$refs_list))
        {
        return 
$images;
        }

    
$refs_rtype ps_query("SELECT ref, resource_type, file_extension FROM resource WHERE ref IN (" ps_param_insert(count($refs_list)) . ")"ps_param_fill($refs_list,"i"),'featured_collections');

    foreach(
$refs_rtype as $ref_rt)
        {
        
$ref $ref_rt['ref'];
        
$resource_type $ref_rt['resource_type'];

        if(
file_exists(get_resource_path($reftrue$sizefalse)) && resource_download_allowed($ref$size$resource_type))
            {
            
$images[] = ["ref" => $ref"path" => get_resource_path($reffalse$sizefalse)];
            }
        }

    if(
count($images) == && count($refs_rtype) != 0)
        {
        
$images[] = $baseurl '/gfx/' get_nopreview_icon($refs_rtype[0]['resource_type'],$refs_rtype[0]['file_extension'],true);
        }

    return 
$images;
    }

This article was last updated 23rd July 2024 07:05 Europe/London time based on the source file dated 19th July 2024 16:55 Europe/London time.