SproutCMS

This is the code documentation for the SproutCMS project

function sizeUrl()

Gets the relative URL for a fixed or dynamically resized image

Usage

string File::sizeUrl ( int $id , string $size_name [, string $force_ext [, bool $create_if_missing ]] );

Arguments

  1. int $id
    ID or filename from record in files table
  2. string $size_name
    The size you want, e.g. 'small', 'banner', 'c100x100', etc.
           The value can either be a size name from the 'file.image_transformations' config option,
           or be a resize code as per File::parseSizeString
  3. string $force_ext = NULL
    Force the ext to a specific value, e.g. 'jpg'
  4. bool $create_if_missing = FALSE
    For numeric size names (e.g. 'c100x100'), causes a resize for any missing files

Return value

  • string
    File URL, e.g. 'file/download/123/small' or 'files/123_test.c100x100.jpg'