Php getimagesize
Getimagesize is used to read Image information and returns an array with four units. Index 0 contains the pixel value of the image width, and index 1 contains the pixel value of the image height. Index 2 is the identifier of the image type.
<? Php
$ Size = getimagesize ($ filename );
$ Fp = fopen ($ filename, "rb ");
If ($ size & $ fp ){
Header ("Content-type: {$ size ['Mime ']}");
Fpassthru ($ fp );
Exit;
} Else {
// Error
}
?>
#2 getimagesize () example
<? Php
List ($ width, $ height, $ type, $ attr) = getimagesize ("img/flag.jpg ");
Echo " ";
?>
Example #3 getimagesize (URL)
<? Php
$ Size = getimagesize ("http://www.example.com/gifs/logo.gif ");
$ Size = getimagesize ("http://www.example.com/gifs/lo%20go.gif ");
?>
Example #4 getimagesize () returning IPTC
<? Php
$ Size = getimagesize ("testimg.jpg", $ info );
If (isset ($ info ["APP13"]) {
$ Iptc = iptcparse ($ info ["APP13"]);
Var_dump ($ iptc );
}
?>