[ERROR] InvalidArgumentException: Wrong file in C:\xampp\htdocs\m234\vendor\magento\framework\Image\Adapter\Gd2.php:64 code example

Example: [ERROR] InvalidArgumentException: Wrong file in C:\xampp\htdocs\magento2.4\lib\internal\Magento\Framework\Image\Adapter\Gd2.php:64 Stack trace

private function validateURLScheme(string $filename) : bool
  {
      $allowed_schemes = ['ftp', 'ftps', 'http', 'https'];
      $url = parse_url($filename);
      if ($url && isset($url['scheme']) && !in_array($url['scheme'], $allowed_schemes) && !file_exists($filename)) {
          return false;
      }

      return true;
  }

Tags:

Php Example