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

get_all_image_sizes()

Parameters

ColumnTypeDefaultDescription
$internal false
$restricted false

Location

include/resource_functions.php lines 7979 to 7998

Definition

 
function get_all_image_sizes($internal=false,$restricted=false)
    {
        
# Returns all image sizes available.
        # Standard image sizes are translated using $lang.  Custom image sizes are i18n translated.

        
$condition=($internal)?"":"WHERE internal!=1";
        if(
$restricted){$condition .= ($condition!=""?" AND ":" WHERE ") . " allow_restricted=1";}

        
# Executes query.
        
$r ps_query("SELECT " columns_in("preview_size") . " FROM preview_size " $condition " ORDER BY width ASC",[],"schema"); // $condition does not contain any user entered params and is safe for inclusion

        # Translates image sizes in the newly created array.
        
$return = array();
        for (
$n 0;$n<count($r);$n++) {
            
$r[$n]["name"] = lang_or_i18n_get_translated($r[$n]["name"], "imagesize-");
            
$return[] = $r[$n];
        }
        return 
$return;

    }

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