Magento 2: Get image url in template file

0
347

Step 1: Put your image on Your Magento 2 Path: /app/design/frontend/< Vendor >/< theme >/web/images

Step 2: Use this code to call the image in phtml file

<?php echo $block->getViewFileUrl(‘images/demo.jpg’); ?>

Ref: chetansanghani, stackexchange