I have a value that may be either an image URL or an image Base64 string. What is the best method to determine which is which? If it's an image URL, the image will already reside on my server.
I've tried doing a preg_match but I think running a preg_match on a potentially huge base64 string will be server intense.
EDIT: The two best methods thus far.
// if not base64 URL
if (substr($str, 0, 5) !== 'data:') {}
// if file exists
if (file_exists($str)) {}