private function decodeDataUrl($data_url)
    {
        if (!is_string($data_url)) {
            return null;
        }

        $pattern = "/^data:(?:image\/[a-zA-Z\-\.]+)(?:charset=\".+\")?;base64,(?P<data>.+)$/";
        preg_match($pattern, $data_url, $matches);

        if (is_array($matches) && array_key_exists('data', $matches)) {
            return base64_decode($matches['data']);
        }

        return null;
    }
private function decodeDataUrl($data_url)
    {
        if (!is_string($data_url)) {
            return null;
        }

        $pattern = "/^data:(?:image\/[a-zA-Z\-\.]+)(?:charset=\".+\")?;base64,(?P<data>.+)$/";
        preg_match($pattern, $data_url, $matches);

        if (is_array($matches) && array_key_exists('data', $matches)) {
            return base64_decode($matches['data']);
        }

        return null;
    }
private function decodeDataUrl ( $ data_url ) { if ( ! is_string ( $ data_url ) ) { return null ; } $ pattern = "/^data:(?:image\/[a-zA-Z\-\.]+)(?:charset=\".+\")?;base64,(?P<data>.+)$/" ; preg_match ( $ pattern , $ data_url , $ matches ) ; if ( is_array ( $ matches ) && array_key_exists ( 'data' , $ matches ) ) { return base64_decode ( $ matches [ 'data' ] ) ; } return null ; }
Parses and decodes binary image data from data-url

@param  string $data_url
@return string
Parses and decodes binary image data from data - url