cancel
Showing results for 
Search instead for 
Did you mean: 

Installation at 51% Magento 2 localhost

Re: Installation at 51% Magento 2 localhost

Open Gd2.php from vendor\magento\framework\Image\Adapter and replace following function 

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)) {
return false;
}

return true;
}

with this  

 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;
}

Re: Installation at 51% Magento 2 localhost

The problem is that in line 63 vendor\magento\framework\Image\Adapter\Gd2.php

 is check

 

if (!$filename || filesize($filename) === 0 || !$this->validateURLScheme($filename))

and more specifically $this->validateURLScheme($filename)

 

private function validateURLScheme(string $filename) : bool
    {
        $allowed_schemes = ['ftp', 'ftps', 'http', 'https']; //There problem for windows developer
        $url = parse_url($filename); //Because this return array('scheme' => 'C') from C:\directory\file.ext
        if ($url && isset($url['scheme']) && !in_array($url['scheme'], $allowed_schemes)) {
            return false;
        }

        return true;
    }

I just added another schema and this work for me

 

   $allowed_schemes = ['ftp', 'ftps', 'http', 'https', 'C'];
 
 

Re: Installation at 51% Magento 2 localhost

You need to perfect the solution please edit the below function on line no 96 follow this- vendor\magento\framework\Image\Adapter\Gd2.php file replaces this line of code or function.

 

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;
  }

  

Re: Instalation at 51% Magento 2 localhost

Find validateURLScheme function in vendor\magento\framework\Image\Adapter\Gd2.php file. at line 96. Replace function with this:

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;   
}
 

Re: Installation at 51% Magento 2 localhost