问题描述:

I got a base64 encoding string. Now i need to get string is a image type or not.

How it possible when image is in base64 string. I am very confused..

网友答案:

You can do this using

$imgData = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAA.';
$Imgpos  = strpos($imgData, ';');
$type = explode(':', substr($imgData, 0, $Imgpos))[1];
相关阅读:
Top