cancel
Showing results for 
Search instead for 
Did you mean: 

Using theme image in module .phtml template

Using theme image in module .phtml template

Hello,

 

I'm trying to include an image from my themes web/images folder inside a module override.

 

I have an image in my theme folder:

app/design/frontend/Vendor/Theme/web/images/amazing.jpg

 

I am wanting to add this image inside a Magento_Theme template override:

app/design/frontend/Vendor/Theme/Magento_Theme/templates/html/header/logo.phtml

 

I've tried adding the following to the logo.phtml, without success:

 

img src="<?php echo $block->getSkinUrl('images/amazing.jpg'); ?>" />

but on render the src is empty.

 

I've also tried using Mage::getDesign()->getSkinUrl('images/amazing.jpg');?> />

 

but this causes a compile error saying "Mage class not found in .... "

 

So maybe that was how to do it in version 1.  Can someone teach me how to put an image inside a module thats in the themes directory?

1 REPLY 1

Re: Using theme image in module .phtml template

How to get the URL of an internal static asset located inside of a module's or theme's web folder in the context of a block's *.phtml template?: https://mage2.pro/t/751