Function __global->cms_getimagesize

Definitions

sources/images.php

  • Find image dimensions of a file path. 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
$path string No No required parameter N/A N/A The path to the image file
$ext ?string No No Null N/A N/A File extension (null: get from path, even if not detected this function will mostly work)

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 file path. Better than PHP's built-in getimagesize as it gets the correct size for animated gifs.
 *
 * @param  string $path The path to the image file
 * @param  ?string $ext File extension (null: get from path, even if not detected this function will mostly work)
 * @return ~array The width (null for vector image), height (null for vector image), file size, and file extension (false: error)
 */

function cms_getimagesize(string $path, ?string $ext = null)