6

... in my phtml view

I want to add a image in my view.

Somebody know how to do it ?

Thanks for help..

11

I hope you ask how to show image in phtml

If you call image from theme

<img src="<?php echo $this->getViewFileUrl('img/image.jpg'); ?>" />

image location should be

app/design/frontend/Vendor/theme/web/img/image.jpg


If you call image from module

<img src="<?php echo $this->getViewFileUrl('Vendor_Module::img/image.jpg'); ?>" />

image location should be

app/code/Vendor/Module/view/frontend/web/img/image.jpg

  • yup that is the default path for static file like js,css,image. If you set developer mode it will generate automatically from module and theme by symlink. If you felt any issue in static file generation follow this answer magento.stackexchange.com/a/94506/36463 – Bilal Usean Feb 8 '17 at 14:53

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