cancel
Showing results for 
Search instead for 
Did you mean: 

Installation at 51% Magento 2 localhost

Highlighted

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

Highlighted

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'];