Ho do I extract an extension of an encoded image using the below method?

  image, parameters, php, strpos, substr

The function is working for me to extract an extension from a long photo encoding but shows me that this; Argument 3 ($length) is (strpos($value, ‘;’)) of type false|int but substr() takes int (false is incompatible) for this below.

$value = data:image/jpeg;base64,/;
$extension = explode('/', explode(':', substr($value, 0, (strpos($value, ';'))))[1])[1];

Source: Ask PHP