English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
La fonction getimagesize() est utilisée pour obtenir la taille de l'image et d'autres informations. En cas de succès, elle retourne un tableau, en cas d'échec, elle retourne FALSE et génère un message d'erreur de niveau E_WARNING.
Format de syntaxe :
array getimagesize ( string $filename [, array &$imageinfo ] )
La fonction getimagesize() détermine toute image GIF, JPG, PNG, SWF, SWC, PSD, TIFF, BMP, IFF, JP2JPX, JB2La taille des fichiers d'images JPC, XBM ou WBMP est déterminée et les dimensions de l'image, le type de fichier et la hauteur et la largeur de l'image sont retournés.
<?php list($width, $height, $type, $attr) = getimagesize("w3codebox-logo.png"); echo "宽度为:" . $width; echo "高度为:" . $height; echo "类型为:" . $attr; ?>
以上示例输出结果为:
宽度为:290 高度为:69 类型为:3 属性:width="290" height="69"
<?php $remote_png_url = 'http://fr.oldtoolbag.com/wp-content/themes/oldtoolbag.com/assets/img/logo-domain-green2.png'; $img_data = getimagesize($remote_png_url); print_r($img_data ); ?>
以上示例输出结果为:
Array ( [0] => 290 [1] => 69 [2] => 3 [3] => width="290" height="69" [bits] => 8 [mime] => image/png )
返回结果说明