Collections functions
Encryption functions
General functions
Render functions
Theme permission functions
Video functions
Resource functions

search_get_previews()

Parameters

ColumnTypeDefaultDescription
$search
$restypes ""
$order_by "relevance"
$archive 0
$fetchrows -1
$sort "DESC"
$access_override false
$starsearch 0
$ignore_filters false
$return_disk_usage false
$recent_search_daylimit ""
$go false
$stats_logging true
$return_refs_only false
$editable_only false
$returnsql false
$getsizes array
$previewextension "jpg"

Location

include/search_functions.php lines 1732 to 1762

Definition

 
function search_get_previews($search,$restypes="",$order_by="relevance",$archive=0,$fetchrows=-1,$sort="DESC",$access_override=false,$starsearch=0,$ignore_filters=false,$return_disk_usage=false,$recent_search_daylimit=""$go=false$stats_logging=true$return_refs_only=false$editable_only=false,$returnsql=false,$getsizes=array(),$previewextension="jpg")
   {
   
# Search capability.
   # Note the subset of the available parameters. We definitely don't want to allow override of permissions or filters.
   
$resultsdo_search($search,$restypes,$order_by,$archive,$fetchrows,$sort,$access_override,$starsearch,$ignore_filters,$return_disk_usage,$recent_search_daylimit,$go,$stats_logging,$return_refs_only,$editable_only,$returnsql);
   if(
is_string($getsizes)){$getsizes=explode(",",$getsizes);}
   if(
is_array($results) && is_array($getsizes) && count($getsizes)>0)
        {
        
$resultcount=count($results);
        for(
$n=0;$n<$resultcount;$n++)
            {
            global 
$access;
            
$access=get_resource_access($results[$n]);
            
$use_watermark=check_use_watermark();

            if(
$results[$n]["access"]==2){continue;} // No images for confidential resources
            
$available=get_all_image_sizes(true,($access==1));
            foreach (
$getsizes as $getsize)
                {
                if(!(
in_array($getsize,array_column($available,"id")))){continue;}
                
$resfile=get_resource_path($results[$n]["ref"],true,$getsize,false,$previewextension,-1,1,$use_watermark);
                if(
file_exists($resfile))
                    {
                    
$results[$n]["url_" $getsize]=get_resource_path($results[$n]["ref"],false,$getsize,false,$previewextension,-1,1,$use_watermark);
                    }
                }

            }
        }
   return 
$results;
   }

This article was last updated 30th November 2020 13:35 Europe/London time based on the source file dated 26th November 2020 14:30 Europe/London time.