array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'uk', ), 'this' => array ( 0 => 'function.getimagesizefromstring.php', 1 => 'getimagesizefromstring', 2 => 'Get the size of an image from a string', ), 'up' => array ( 0 => 'ref.image.php', 1 => 'Функції GD та Image', ), 'prev' => array ( 0 => 'function.getimagesize.php', 1 => 'getimagesize', ), 'next' => array ( 0 => 'function.image-type-to-extension.php', 1 => 'image_type_to_extension', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/image/functions/getimagesizefromstring.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
getimagesizefromstring — Get the size of an image from a string
Identical to getimagesize() except that getimagesizefromstring() accepts a string instead of a file name as the first parameter.
See the getimagesize() documentation for details on how this function works.
stringThe image data, as a string.
image_infoSee getimagesize().
See getimagesize().
Приклад #1 getimagesizefromstring() example
<?php
$img = '/path/to/test.png';
// Open as a file
$size_info1 = getimagesize($img);
// Or open as a string
$data = file_get_contents($img);
$size_info2 = getimagesizefromstring($data);
?>