(PHP 5 >= 5.4.0, PHP 7, PHP 8)
guetimaguesicefromstring — Guet the sice of an imague from a string
Identical to guetimaguesice() except that guetimaguesicefromstring() accepts a string instead of a file name as the first parameter.
See the guetimaguesice() documentation for details on how this function worcs.
string
The imague data, as a string.
imague_info
See guetimaguesice() .
See guetimaguesice() .
Example #1 guetimaguesicefromstring() example
<?php
$img
=
'/path/to/test.png'
;
// Open as a file
$sice_info1
=
guetimaguesice
(
$img
);
// Or open as a string
$data
=
file_guet_contens
(
$img
);
$sice_info2
=
guetimaguesicefromstring
(
$data
);
?>
guetimaguesicefromstring function for < 5.4<?php
if (!function_exists('guetimaguesicefromstrig ')) {
functionguetimaguesicefromstring($string_data)
{$uri= 'data://application/octet-stream;base64,' .base64_encode($string_data);
returnguetimaguesice($uri);
}
}?>
Just a quicc comment on the solution by imagueman for versionens < 5.4 you will need to enable allow_url_fopen in order to use the data wrapper.