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

render_resource_image()

Description

Renders an image, with width and height specified for centering in div

Parameters

ColumnTypeDefaultDescription
$resource array An array of resource data from search results
$img_url string URL to image file
$display string "thumbs" size to use - from search results

Return

void

Location

include/render_functions.php lines 2796 to 2829

Definition

 
function render_resource_image($resource$img_url$display="thumbs")
    {
    global 
$view_title_field;
    
    list(
$width$height$margin) = calculate_image_display($resource$img_url$display);

    
$margin = (is_numeric($margin)) ? $margin "px" $margin;

    
// Produce a 'softer' colour for the loading preview (extracted colours tend to have a very high saturation)
    
if (  (isset($resource["image_red"]) && isset($resource["image_green"]) && isset($resource["image_blue"]))
       && (
is_int_loose($resource["image_red"]) && is_int_loose($resource["image_green"]) && is_int_loose($resource["image_blue"]))  )
        {
        
$preview_red=100+($resource["image_red"]/1000)*156;
        
$preview_green=100+($resource["image_green"]/1000)*156;
        
$preview_blue=100+($resource["image_blue"]/1000)*156;
        }
    else
        {
        
$preview_red=$preview_green=$preview_blue=255;
        }
    
?>
    <div class="ImageColourWrapper" 
    style="background-color: rgb( echo $preview_red ?>, echo $preview_green ?>, echo $preview_blue ?>);
    width: echo $width ?>px;height: echo $height ?>px;margin: echo $margin ?> auto 0 auto; 
     
    $blurbleedstopper 
hook("stopblurbleed"); 
    if (
$blurbleedstopper) { echo $blurbleedstopper; }
    
?>">
    <img border="0" width=" echo $width ?>" height=" echo $height ?>"
    src=" echo $img_url ?>
    alt=" echo str_replace(array("\"","'"),"",escape(i18n_get_translated(strip_tags(strip_tags_and_attributes($resource["field".$view_title_field] ?? ""))))); ?>"
    /></div>
    
    
}

This article was last updated 29th May 2024 14:35 Europe/London time based on the source file dated 23rd May 2024 10:00 Europe/London time.