private function validMimeImage($extension, $mimes)
    {
        if (is_array($mimes)) {
            foreach ($mimes as $mime) {
                if (!strstr($mime, 'image/')) {
                    throw new \InvalidArgumentException(htmlspecialchars(
                        "The extension $extension is not an image extension."
                    ));
                }
            }
        } else {
            if (!strstr($mimes, 'image/')) {
                throw new \InvalidArgumentException(htmlspecialchars(
                    "The extension $extension is not an image extension."
                ));
            }
        }
    }