Function __global->cms_getimagesizefromstring

Definitions

sources/images.php

  • Find image dimensions from a string. 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
$data string No No required parameter N/A N/A The image file data
$ext ?string No No Null N/A N/A File extension (null: unknown)

Returns

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

Preview

Code (PHP)

/**
 * Find image dimensions from a string. Better than PHP's built-in getimagesize as it gets the correct size for animated gifs.
 *
 * @param  string $data The image file data
 * @param  ?string $ext File extension (null: unknown)
 * @return ~array The width (null for vector image) and height (null for vector image) (false: error)
 */

function cms_getimagesizefromstring(string $data, ?string $ext = null)