# Add image tag using api.onToolbarCreate

**URL:** https://meta.discourse.org/t/add-image-tag-using-api-ontoolbarcreate/386800
**Category:** Development
**Created:** [October 27, 2025, 10:21am UTC](https://meta.discourse.org/t/add-image-tag-using-api-ontoolbarcreate/386800 "2025-10-27T10:21:23Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![NateDhaliwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natedhaliwal/32/313494_2.png) [@NateDhaliwal](https://meta.discourse.org/u/NateDhaliwal)
#### Post date: [October 27, 2025, 10:21am UTC](https://meta.discourse.org/t/add-image-tag-using-api-ontoolbarcreate/386800/1 "2025-10-27T10:21:23Z")

</div>

If I have this in my `api.onToolbarCreate`:

```js
perform: (e) => {
  e.applySurround(
    `[wrap="Carousel" autoplay=${settings.autoplay}]\n`,
    "\n[/wrap]",
    "image_carousel_placeholder"
  );
}

```

And my `image_carousel_placeholder` setting is as such:

```yml
image_carousel_placeholder:
  type: upload
  default: "placeholder_image"

```

It adds the image url of the image, not the `<img>` tag or the markdown `![]` equivalent. How do I go about doing this? I’m trying to avoid the option of the setting as a string to input an actual `<img>` tag. Is this possible?

---

<div class="post-metadata">

### Author: ![NateDhaliwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natedhaliwal/32/313494_2.png) [@NateDhaliwal](https://meta.discourse.org/u/NateDhaliwal)
#### Post date: [October 27, 2025, 10:36am UTC](https://meta.discourse.org/t/add-image-tag-using-api-ontoolbarcreate/386800/2 "2025-10-27T10:36:22Z")

</div>

Silly me. I completely missed the `I18n.translations[currentLocale].js.composer.image_carousel_placeholder` line above that.  
Now:

```plaintext
I18n.translations[currentLocale].js.composer.image_carousel_placeholder = `<img src="${settings.image_carousel_placeholder}" height="200" width="300" />`;

```

That works _much_ better.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [November 26, 2025, 10:37am UTC](https://meta.discourse.org/t/add-image-tag-using-api-ontoolbarcreate/386800/3 "2025-11-26T10:37:03Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
