อย่างเช่น เราจะดูค่าขนาดของรูปภาพ ให้เรา เรียกดูข้อมูลของรูปภาพโดยใช้ คำสั่ง
Code: Select all
<?php
$image_info = getimagesize("test.png");
print_r($image_info);
?>
Code: Select all
Array ( [0] => 600
[1] => 200
[2] => 3
[3] => width="600" height="200"
[bits] => 8
[mime] => image/png )
ถ้าเราจะนำไปประยุกต์นำค่ามาแสดงทำได้โดยดังนี้
<?php
Code: Select all
list($width, $height, $type, $attr) = getimagesize("test.png");
echo "Width : " . $width . "<br>";
echo "Height : " . $height . "<br>";
echo "Image type :" . $type . "<br>";
echo "Image attribute :" .$attr;
?>