6

... in my phtml view

I want to add a image in my view.

Somebody know how to do it ?

Thanks for help..

Matthéo Geoffray
  • 2,684
  • 2
  • 20
  • 45
user3092453
  • 139
  • 2
  • 9

1 Answers1

13

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

Bilal Usean
  • 9,977
  • 14
  • 75
  • 122
  • 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 http://magento.stackexchange.com/a/94506/36463 – Bilal Usean Feb 08 '17 at 14:53