Function __global->_ensure_thumbnail

Definitions

sources/images2.php

  • (Helper for ensure_thumbnail).
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: string

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$full_url URLPATH No No required parameter N/A N/A The full URL to the image which will-be/is thumbnailed
$thumb_url URLPATH No No required parameter N/A N/A The URL to the thumbnail (blank: no thumbnail yet)
$thumb_dir ID_TEXT No No required parameter N/A N/A The directory, relative to the software install's uploads directory, where the thumbnails are stored. MINUS "_thumbs"
$table ID_TEXT No No required parameter N/A N/A The name of the table that is storing what we are doing the thumbnail for
$id AUTO_LINK No No required parameter N/A N/A The ID of the table record that is storing what we are doing the thumbnail for
$image_field_name ID_TEXT No No thumb_url N/A N/A The name of the table field where thumbnails are saved
$thumb_width ?integer No No Null N/A N/A The thumbnail width to use (null: default)
$only_make_smaller boolean No No False N/A N/A Whether to apply a 'never make the image bigger' rule for thumbnail creation (would affect very small images)
$original_filename ?string No No Null N/A N/A Original filename of image (null: unknown)

Returns

  • The URL to the thumbnail
  • Type: URLPATH
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * (Helper for ensure_thumbnail).
 *
 * @param  URLPATH $full_url The full URL to the image which will-be/is thumbnailed
 * @param  URLPATH $thumb_url The URL to the thumbnail (blank: no thumbnail yet)
 * @param  ID_TEXT $thumb_dir The directory, relative to the software install's uploads directory, where the thumbnails are stored. MINUS "_thumbs"
 * @param  ID_TEXT $table The name of the table that is storing what we are doing the thumbnail for
 * @param  AUTO_LINK $id The ID of the table record that is storing what we are doing the thumbnail for
 * @param  ID_TEXT $image_field_name The name of the table field where thumbnails are saved
 * @param  ?integer $thumb_width The thumbnail width to use (null: default)
 * @param  boolean $only_make_smaller Whether to apply a 'never make the image bigger' rule for thumbnail creation (would affect very small images)
 * @param  ?string $original_filename Original filename of image (null: unknown)
 * @return URLPATH The URL to the thumbnail
 */

function _ensure_thumbnail(string $full_url, string $thumb_url, string $thumb_dir, string $table, int $id, string $image_field_name = 'thumb_url', ?int $thumb_width = null, bool $only_make_smaller = false, ?string $original_filename = null) : string