Collections functions
Encryption functions
General functions
Theme permission functions
Resource functions

get_nopreview_icon()

Description

Returns the path (relative to the gfx folder) of a suitable folder to represent
a resource with the given resource type or extension
Extension matches are tried first, followed by resource type matches
Finally, if there are no matches then the 'type1' image will be used.
set contactsheet to true to cd up one more level.

Parameters

ColumnTypeDefaultDescription
$resource_type integer
$extension string
$col_size boolean

Return

string

Location

include/resource_functions.php lines 7437 to 7495

Definition

 
function get_nopreview_icon($resource_type$extension$col_size)
    {
    global 
$language;
    
    
$col=($col_size?"_col":"");
    
$folder=dirname(dirname(__FILE__)) . "/gfx/";
    
$extension=strtolower($extension);

    
# Metadata template? Always use icon for 'mdtr', although typically no file will be attached.
    
global $metadata_template_resource_type;
    if (isset(
$metadata_template_resource_type) && $metadata_template_resource_type==$resource_type) {$extension="mdtr";}

    
# Try a plugin
    
$try=hook('plugin_nopreview_icon','',array($resource_type,$col$extension));
    if (
false !== $try && file_exists($folder $try))
        {
        return 
$try;
        }

    
# Try extension (language specific)
    
$try="no_preview/extension/" $extension $col "_" $language ".png";
    if (
file_exists($folder $try))
        {
        return 
$try;
        }
    
# Try extension (default)
    
$try="no_preview/extension/" $extension $col ".png";
    if (
file_exists($folder $try))
        {
        return 
$try;
        }
    
    
# --- Legacy ---
    # Support the old location for resource type and GIF format (root of gfx folder)
    # Some installations use custom types in this location.
    
$try="type" $resource_type $col ".gif";
    if (
file_exists($folder $try))
        {
        return 
$try;
        }


    
# Try resource type (language specific)
    
$try="no_preview/resource_type/type" $resource_type $col "_" $language ".png";
    if (
file_exists($folder $try))
        {
        return 
$try;
        }
    
# Try resource type (default)
    
$try="no_preview/resource_type/type" $resource_type $col ".png";
    if (
file_exists($folder $try))
        {
        return 
$try;
        }
    
    
    
# Fall back to the 'no preview' icon used for type 1.
    
return "no_preview/resource_type/type1" $col ".png";
    }

This article was last updated 5th July 2020 04:05 Europe/London time based on the source file dated 30th June 2020 12:14 Europe/London time.