I have 2 custom blocks, one is loading a product collection from category ID and another one loading a single product from product ID.

My blocks extends the core Magento product list block (\Magento\Catalog\Block\Product\ListProduct).

My template is also a duplicate of the core template.

When calling $block->getImage($_product, $image); It throws an error.

Unable to resolve the source file for 'frontend/_view/en_GB/Magento_Catalog/images/product/placeholder/.jpg'

I've been debugging this for quite a while and can't get to the bottom of it.

When comparing it to the collection on a category list page everything seems identical. The products are the same and have all the same data (including an image).

Any suggestions would be massively helpful.

Code in the template:

$productImage = $block->getImage($_product, $image);

Code in the block:

use Magento\Catalog\Api\CategoryRepositoryInterface;
use Magento\Catalog\Model\Product;

class Category extends \Magento\Catalog\Block\Product\ListProduct
 public function __construct(
        \Magento\Catalog\Block\Product\Context $context,
        \Magento\Framework\Data\Helper\PostHelper $postDataHelper,
        \Magento\Catalog\Model\Layer\Resolver $layerResolver,
        CategoryRepositoryInterface $categoryRepository,
        \Magento\Framework\Url\Helper\Data $urlHelper,
        array $data = []
    ) {
            $context, $postDataHelper, $layerResolver, $categoryRepository, $urlHelper, $data

From further digging it seems to be something to do with a resize function that is called from getImage. Could this be something to do with xml?

  • add your code to more reference in questions. May 6, 2016 at 5:13
  • Did you find the solution?
    – 3CE
    Oct 30, 2017 at 13:50

1 Answer 1


I found the same issue in Magento 2.1.0.

After debugging I found that

1) the placeholder images were broken/missing in

Store -> Configuration -> Catalog -> Product Image Placeholders

2) Imagick library wasn't installed.

Updated those two things the error Unable to resolve the source file got fixed.

Hope it helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.