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

render_resource_image()

Description

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

Parameters

ColumnTypeDefaultDescription
$imagedata array An array of resource data - usually 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 2486 to 2514

Definition

 
function render_resource_image($imagedata$img_url$display="thumbs")
    {
    global 
$view_title_field;
    
    list(
$width$height$margin) = calculate_image_display($imagedata$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($imagedata["image_red"]) && isset($imagedata["image_green"]) && isset($imagedata["image_green"]))
        {
        
$preview_red=100+($imagedata["image_red"]/1000)*156;
        
$preview_green=100+($imagedata["image_green"]/1000)*156;
        
$preview_blue=100+($imagedata["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;"><img
    border="0"
    width=" echo $width ?>
    height=" echo $height ?>"
    src=" echo $img_url ?>
    alt=" echo str_replace(array("\"","'"),"",htmlspecialchars(i18n_get_translated(strip_tags(strip_tags_and_attributes($imagedata["field".$view_title_field]))))); ?>"
    /></div>
    
    
}

This article was last updated 30th November 2020 16:05 Europe/London time based on the source file dated 13th November 2020 15:00 Europe/London time.