Function __global->cms_getimagesize_url

Definitions

sources/images.php

  • Find image dimensions of a URL. Better than PHP's built-in getimagesize as it gets the correct size for animated gifs.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$url URLPATH No No required parameter N/A N/A The URL to the image file, may be a local URL
$only_if_local boolean No No False N/A N/A Whether only to accept local URLs (usually for performance reasons)

Returns

  • The width (null for vector image), height (null for vector image), file size, and file extension (false: error)
  • Type: ~array
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Find image dimensions of a URL. Better than PHP's built-in getimagesize as it gets the correct size for animated gifs.
 *
 * @param  URLPATH $url The URL to the image file, may be a local URL
 * @param  boolean $only_if_local Whether only to accept local URLs (usually for performance reasons)
 * @return ~array The width (null for vector image), height (null for vector image), file size, and file extension (false: error)
 */

function cms_getimagesize_url(string $url, bool $only_if_local = false)