PHP Function GetImageSizeFromString
The php function getimagesizefromstring is used to retrieve image size information from a string. It's similar to getimagesize(), but it takes a string representation of the image data instead of the file name as the first parameter. It also registers the new image sub-sizes and updates the image metadata to reflect them. It's a very useful function for creating a cropped version of an existing image attachment or for handling images via AJAX.
$filename = the path to a local or remote image file. $imageinfo = optionally passed by reference. If so, it's filled with extended image information such as the different JPG APP markers as an associative array.
The first two elements (index 0 and 1) in the array will contain the width and height of the image. The mime key in the array will return the correspondent MIME type of the image file - useful for delivering files with a correct HTTP Content-type header. The last element (index 3) in the array will return a text string with the correct height="yyy" width="xxx" string that can be used directly in an IMG tag. The 'channels' and 'bits' elements will be 3 for RGB pictures and 4 for CMYK pictures. If a valid image cannot be determined, this function will report an error. Otherwise, it returns a true value if the function succeeded or false on failure. This function uses gd library to retrieve the image information, so it requires that GD is installed and enabled on your web server.