Magento 2: Getting “Warning: getimagesize(): Filename cannot be empty” after switching to a new empty theme with no parent

magento.stackexchange https://magento.stackexchange.com/questions/207837

Вопрос

I wanted to start building a theme from scratch & my first step was to create a new theme with "Blank" as a parent. I then browsed a few pages & saw that everything works just fine.
On the next step, I removed the parent from my theme & checked again.
Now, the homepage loads OK (only with no CSS, as expected), but on categories & product pages I get this exception:

Exception #0 (Exception): Warning: getimagesize(): Filename cannot be empty in {Magento-Root-Dir}/vendor/magento/module-catalog/Model/Product/Image.php on line 890
...

Thing I already tried (that didn't solve the problem):
* Reset owner & permissions.
* Removing all the generated stuff (cache, page_cache, view_preprocessed, generation, generated, di, static files, ...) & catalog images cache.
* Running all sort of CLI commands like setup:upgrade, setup:static-content:deploy, setup:di:compile, ...
* Resizing product images using catalog:images:resize.


* I'm using Magento 2.2.2 with developer mode enabled.
* Environment: Ubuntu 16.04 LTS + Apache/2.4.18 & php7.0.26
-- Any Idea??

UPDATE:
During some debugging I discovered that the method getMediaAttributes when called from \Magento\Catalog\Helper\Image on line 191, returns different results for Blank theme than my custom parentless theme. On my theme it's like the product has no images (& it's the same product). Does it ring a bell? So far that's what I found out...

Это было полезно?

Решение

The problem is in /etc/view.xml some sizes are missing, you can use the default file form luma theme and change the image sizes in it and it should work.

Другие советы

Usually it happens when magento can not access product images or even default placeholder. solution can come in two ways:

First, rechecking the file and folder permissions for media folder & sub-folders.

Second, re-upload product images and also assign default placeholder from following path

Admin > Configuration > Catalog > Product Image Placeholders

Лицензировано под: CC-BY-SA с атрибуция
Не связан с magento.stackexchange
scroll top