PHP » GoLang |
login |
register |
about
|
getimagesize(PHP 4, PHP 5, PHP 7) getimagesize — Get the size of an image Description
array getimagesize
( string
$filename
[, array &$imageinfo
] )
The getimagesize() function will determine the
size of any supported given image file and return the dimensions along with
the file type and a height/width text string to be used inside a
normal HTML
getimagesize() can also return some more information
in Caution
This function expects Do not use getimagesize() to check that a given file is a valid image. Use a purpose-built solution such as the Fileinfo extension instead.
Parameters
Return ValuesReturns an array with up to 7 elements. Not all image types will include the channels and bits elements. Index 0 and 1 contains respectively the width and the height of the image.
Index 2 is one of the IMAGETYPE_XXX constants indicating the type of the image. Index 3 is a text string with the correct height="yyy" width="xxx" string that can be used directly in an IMG tag. mime is the correspondant MIME type of the image. This information can be used to deliver images with the correct HTTP Content-type header: Example #1 getimagesize() and MIME types
<?php channels will be 3 for RGB pictures and 4 for CMYK pictures. bits is the number of bits for each color. For some image types, the presence of channels and bits values can be a bit confusing. As an example, GIF always uses 3 channels per pixel, but the number of bits per pixel cannot be calculated for an animated GIF with a global color table.
On failure, Errors/Exceptions
If accessing the Changelog
Examples
Example #2 getimagesize() example
<?php Example #3 getimagesize (URL)
<?php Example #4 getimagesize() returning IPTC
<?php Notes
See Also
|
more
Recently updated
more
Most requested
more
Last requests
|