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

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 3141 to 3172

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/no_preview/default.png';
        }

    return 
$images;
    }

This article was last updated 17th November 2024 15:35 Europe/London time based on the source file dated 13th November 2024 15:50 Europe/London time.