Due to my low reputation I cannot add a comment :/
What to you see when run var_dump($images['name'])
;?
I guess this one might solve your problem:
count([$images['name']]);
Whatever $images['name'] is will be inserted into array which will allow count function to proceed.
Another option is to make sure that $images['name'] is not null. Depending on php version there might be a warning if null is passed to count
function. For php => 7 will be like this:
$images = $images['name'] ?? [];
Otherwise :
$images = ($images['name']) ? $images['name'] : [];
Your questions looks like a duplication. In general would advice first google the topic and only then add a question here : ]