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

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 2884 to 2917

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 12th December 2024 20:35 Europe/London time based on the source file dated 12th December 2024 19:40 Europe/London time.