- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There is a new check in /vendor/magento/framework/image/adapter/Gd2.php on line 62
if (!$filename || filesize($filename) === 0 || !$this->validateURLScheme($filename))
The validateURLScheme is new and that function performs a check to ensure the file is referenced with the following labels:
$allowed_schemes = ['ftp', 'ftps', 'http', 'https'];
The system Im developing on is Windows and the image passed file is referenced by a directory structure (ie: D:/xampp/htdocs ..... ) and so it fails this test. Putting a return true at this function allows me to continue but makes me wonder if Ive applied my images in the wrong way into the system.
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @virgil_long
Find validateURLScheme function in below file.
vendor\magento\framework\Image\Adapter\Gd2.php
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; }
If issue resolve, please click on 'Kudos' & Accept as Solution!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Magento 2.3.5 gd2.php adds new condition that prevents images from displaying
Yes this has been added to check $this->validateURLScheme($filename)
$allowed_schemes = ['ftp', 'ftps', 'http', 'https'];
Most of window system faced this error during local development. It will work on your live server. So for local you can skip this.
https://www.manishmittal.com/
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @virgil_long
Find validateURLScheme function in below file.
vendor\magento\framework\Image\Adapter\Gd2.php
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; }
If issue resolve, please click on 'Kudos' & Accept as Solution!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Magento 2.3.5 gd2.php adds new condition that prevents images from displaying
&& !file_exists($filename)) this part was missing on my site. thanks a lot bro.