php getimagesize
getimagesize reads image-related information and returns an array with four cells. Index 0 contains the pixel values for the width of the image, and index 1 contains the pixel values for the height of the image. Index 2 is the index of the image type
$size = getimagesize($filename);
$fp = fopen($filename, "rb");
if ( $size && $fp) {
header("Content-type: {$size['mime']}");
fpassthru($fp);
exit;
} else {
// error
}
?>
#2 getimagesize() example
list($width, $height , $type, $attr) = getimagesize("img/flag.jpg");
echo "" ;
?>
Example #3 getimagesize (URL)
$size = getimagesize("http://www.example.com/gifs /logo.gif");
$size = getimagesize("http://www.example.com/gifs/lo%20go.gif");
?>
Example # 4 getimagesize() returning IPTC
$size = getimagesize("testimg.jpg", $info);
if (isset($info["APP13"])) {
$iptc = iptcparse($info["APP13"]);
var_dump($iptc);
}
?>