# How do I register a public asset in a plugin?

**URL:** https://meta.discourse.org/t/how-do-i-register-a-public-asset-in-a-plugin/68660
**Category:** Development
**Created:** [8월 23, 2017, 10:40오후 UTC](https://meta.discourse.org/t/how-do-i-register-a-public-asset-in-a-plugin/68660 "2017-08-23T22:40:13Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![featheredtoast](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/featheredtoast/32/116994_2.png) [@featheredtoast](https://meta.discourse.org/u/featheredtoast)
#### Post date: [8월 23, 2017, 10:40오후 UTC](https://meta.discourse.org/t/how-do-i-register-a-public-asset-in-a-plugin/68660/1 "2017-08-23T22:40:13Z")

</div>

Forgive me if this has been asked before, but I am unable to find a previous topic on this.

I’m wondering how to register an asset as public (such as an image) through a discourse plugin - it seems currently after registering, I get a 404 or 302 response when installing under a private member’s only site.

This is in reference to the [Discord oauth plugin](https://meta.discourse.org/t/discord-oauth2-plugin/67174) I built - I am unable to retrieve the image either directly, or through a `register_asset` call.

How would I go about serving static plugin assets in this case?

---

<div class="post-metadata">

### Author: ![Nikolay](https://avatars.discourse-cdn.com/v4/letter/n/a698b9/32.png) [@Nikolay](https://meta.discourse.org/u/Nikolay)
#### Post date: [3월 25, 2020, 4:18오후 UTC](https://meta.discourse.org/t/how-do-i-register-a-public-asset-in-a-plugin/68660/4 "2020-03-25T16:18:56Z")

</div>

안녕하세요, 저도 정보를 받을 수 있을까요? 저도 같은 문제를 겪고 있어서요.

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [3월 25, 2020, 11:06오후 UTC](https://meta.discourse.org/t/how-do-i-register-a-public-asset-in-a-plugin/68660/5 "2020-03-25T23:06:21Z")

</div>

> [@Nikolay](#):
>
> 안녕하세요, 저도 정보를 받을 수 있을까요?

물론입니다. 해당 주제는 삭제되었습니다. 그 주제에는 플러그인에서 공개 자산을 등록하는 방법을 예시로 보여주는 오래된 Discourse 플러그인 링크가 포함되어 있었습니다: [GitHub - eviltrout/trout\_emoji: Adds an evil trout emoji to a discourse install · GitHub](https://github.com/eviltrout/trout_emoji).

마지막으로 테스트했을 때, 플러그인의 `public/images` 디렉토리에 이미지를 추가하면 서버에서 `/plugins/plugin_name/images/` 경로로 사용할 수 있게 됩니다.

경로에 사용하는 플러그인 이름은 `plugin.rb` 파일 상단의 메타데이터에서 지정한 플러그인 이름입니다. 예를 들어 `/plugins/trout_emoji/images/trout-square.jpg`와 같습니다.

---

<div class="post-metadata">

### Author: ![Nikolay](https://avatars.discourse-cdn.com/v4/letter/n/a698b9/32.png) [@Nikolay](https://meta.discourse.org/u/Nikolay)
#### Post date: [3월 26, 2020, 2:55오후 UTC](https://meta.discourse.org/t/how-do-i-register-a-public-asset-in-a-plugin/68660/6 "2020-03-26T14:55:58Z")

</div>

정말 감사합니다. 이제 잘 작동합니다. 문제가 발생했던 이유는 경로에 있는 플러그인 이름이 폴더 이름이라고 생각했기 때문이었습니다 🙂
