getimagesizefromstring PHP - Obtenir fonction de détails image
getimagesizefromstring PHP - Obtenir fonction de détails image
getimagesizefromstring - Obtenir des informations de taille de l'image à partir d'une chaîne.
grammaire
array getimagesizefromstring ( string $imagedata [, array &$imageinfo ] )
Avec getimagesize () fonction. La différence est getimagesizefromstring () Le premier paramètre est la représentation de chaîne de données d'image, pas le nom du fichier.
Paramètres
- imagedata: une représentation de chaîne des données d'image.
- imageinfo: Voir aussi getimagesize () fonction.
Exemples
<?php $img = 'w3big-logo.png'; // 以文件方式打开 $size_info1 = getimagesize($img); // 以字符串格式打开 $data = file_get_contents($img); $size_info2 = getimagesizefromstring($data); print_r($size_info2); ?>
L'exemple ci-dessus sortie est:
Array ( [0] => 290 [1] => 69 [2] => 3 [3] => width="290" height="69" [bits] => 8 [mime] => image/png )