I found the answer to this for Magento 1.x, but I can't find a 2.0x solution.

On my category pages, before the products are shown, there is a huge image, "category-image".

Does anyone know where the phtml file is that loads this image?

Thanks so much!

  • It would be great if you can share screen shot that may help me to understand which image of category are you talking about. – Aman Alam Jun 22 '16 at 18:16
up vote 2 down vote accepted

You can find this in your theme

app\design\frontend\{packagename}\{themename}\Magento_Catalog\templates\category\image.phtml

If you don't find the file here then you can create your own with same name having content:

<?php
    $_helper    = $this->helper('Magento\Catalog\Helper\Output');
    $_category  = $block->getCurrentCategory();
    $_imgHtml   = '';
    if ($_imgUrl = $_category->getImageUrl()) {
        $_imgHtml = '<div class="category-image"><img src="' . $_imgUrl . '" alt="' . $block->escapeHtml($_category->getName()) . '" title="' . $block->escapeHtml($_category->getName()) . '" class="image" /></div>';
        $_imgHtml = $_helper->categoryAttribute($_category, $_imgHtml, 'image');
        /* @escapeNotVerified */ echo $_imgHtml;
    }
?>

and you can modify it as you want. :)

Magento uses fallback method so this file is initially placed in Magento_Catalog::view/frontend/templates/category/image.phtml
You can overwrite it in your theme.

  • Thanks so much for this help. I had found this file earlier, and assumed this was what I needed to change, but was unsure on how to completely remove the image without causing a broken link. – Jeremy Lester Jun 22 '16 at 19:56

Go to vendor\magento\module-catalog\view\frontend\templates\category and look for file image.phtml. This file is responsible to display Category image before rendering products. You can override this file in your magento designed theme, and can modify as per your requirements.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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