# How load image from current directory

**URL:** <https://forum.shopware.com/t/how-load-image-from-current-directory/88141>\
**Category:** Shopware 6 (English)\
**Created:** [6. Juni 2021 um 18:11 UTC](https://forum.shopware.com/t/how-load-image-from-current-directory/88141 "2021-06-06T18:11:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![shivam201312](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@shivam201312](https://forum.shopware.com/u/shivam201312)\
**Post date:** [6. Juni 2021 um 18:11 UTC](https://forum.shopware.com/t/how-load-image-from-current-directory/88141/1 "2021-06-06T18:11:23Z")

</div>

**Plugin directory** :

```auto
$PROJECTROOT
	- src
		-- Controller
		-- Resources
			-- app
			-- administration
			-- build
				--- webpack.config.js
			-- img
				--- shopwareimage.jpg
			-- js
			-- src
				--- folder-name
					---- page
						----- folder-name
							------- index.js
							------- file.html.twig
							------- filename.scss
							------- shopwareimage.jpg
					---- index.js
				--- main.js

```

**Webpack.config.js**

```auto
const { join, resolve } = require('path');

module.exports = () => {
    return {
    	output: {
    		publicPath:join(__dirname, '..', 'img')
    	},
        resolve: {
            alias: {
                '@slugify': resolve(
                    join(__dirname, '..', 'node_modules', 'slugify')
                )
            }
        }
    };
}

```

**index.js**

```auto
import { Component, Mixin } from 'src/core/shopware';
import template from './file.html.twig';
Component.register('component-name', {
	template,
	data() {
		return {
		    image:require("./shopwareimage.jpg")
		};
	},
});

```

**file.html.twig**

```auto
{% block name %}
	<sw-page class="oxy-hubspot-auth">
		<template>
			<img v-bind:src={{image}}>
		</template>
	</sw-page>
{% endblock %}

```

I want to display image that is in the img or folder-name  
i tried to use require method but didn’t work  
i have tried to set public path publicPath to webpack but it also didn’t work

How can i display image which is with in same directory of twig file ?

---

<div class="post-metadata">

**Author:** ![ninja](https://avatars.discourse-cdn.com/v4/letter/n/53a042/32.png) [@ninja](https://forum.shopware.com/u/ninja)\
**Post date:** [7. Juni 2021 um 12:19 UTC](https://forum.shopware.com/t/how-load-image-from-current-directory/88141/2 "2021-06-07T12:19:11Z")

</div>

You need to put your assets into the public folder and the run bin/console assets:install.  
After you did that you can easily link to your assets like this:  
 ![]()

Also look at the documentation: [Add custom assets - Shopware Developer](https://developer.shopware.com/docs/guides/plugins/plugins/storefront/add-custom-assets)
