How to get the image size from the base of 64 strings in php


I am getting the base 64 for string for image I have to move in folder and store the image path in database but I have to limit the file size.How can I do this:

My code for generate image from base 64 string is like:

/** if image is attached with request **/
 $Image = "MyBase64StringHere";
 list($type, $Image) = explode(';', $Image);
 list(, $Image)      = explode(',', $Image);

/** decode the base 64 image **/
 $Image = base64_decode($Image);

I have tried to get image size like:
$size =  getimagesize($Image);

But from this am getting file width and height.Can someone tell me how can I get file size from this.Thanks

Please check this :

After decoding, try with this : getimagesizefromstring(), if you are with PHP 5.4, if using PHP 5.3, then you can check with the following method.

if (!function_exists('getimagesizefromstring')) {
    function getimagesizefromstring($data)
        $uri = 'data://application/octet-stream;base64,' . base64_encode($data);
        return getimagesize($uri);