QuackieMackie
New member
I just got finished with creating a template for my custom thread type, right now the template modifications are using place holder values.
I want to be able to upload an image when a thread is created or edited.
Does anyone know how I might go about doing this, or if it's even possible?
The text on the screenshot is ai generated, I couldn't be bothered to write anything.
Edit [12/06/2025 - 16:20]:The plan is to try and add an option to this part here:

Edit [12/06/2025 - 23:38]: This method was a bust. To add an option to that you need to edit or create a new js script. The script for this is
Solution
Step 1: Adding the attachment image into the first post of the custom thread type.
First I modify the template for
But the important part for the image is this:
This was added into the post, but what does it do?
Basically it fetches the first attachment in the post, and renders it into the content directly into the post rather than in the text box. If that does not exist, it just uses an exmpty value and it looks normal.
Step 2: Making it so we don't see attachments on the first post of the custom thread.
Secondly I remove the attachments from the post, this is to simplify the look of the first post. This defiently be handled better though.
The template
With this:
This does not show all the changes to the
I want to be able to upload an image when a thread is created or edited.
Does anyone know how I might go about doing this, or if it's even possible?
The text on the screenshot is ai generated, I couldn't be bothered to write anything.
Edit [12/06/2025 - 16:20]:

Edit [12/06/2025 - 23:38]: This method was a bust. To add an option to that you need to edit or create a new js script. The script for this is
/js/xf/attachment_manager.js
and editing this will cause a file health check issue. Instead I landed on a solution I'm not overally happy with, but it works.Solution
Step 1: Adding the attachment image into the first post of the custom thread type.
First I modify the template for
post_macros
, this modification is for the actual layout of the content of the first post. So as you can imagine I butchered it a bunch.But the important part for the image is this:
HTML:
<xf:if is="$post.isFirstPost() && $thread.discussion_type === 'story'">
<xf:set var="$coverUrl" value="{{ $thread.getCoverImage() ?: '' }}" />
<xf:if is="$coverUrl">
<div class="story-post-image">
<img src="{$coverUrl}"
alt="Story cover"
style="max-width: 10vw; height: auto; border-radius: 0.5rem;">
</div>
</xf:if>
</xf:if>
Basically it fetches the first attachment in the post, and renders it into the content directly into the post rather than in the text box. If that does not exist, it just uses an exmpty value and it looks normal.
Step 2: Making it so we don't see attachments on the first post of the custom thread.
Secondly I remove the attachments from the post, this is to simplify the look of the first post. This defiently be handled better though.
The template
post_macros
gets this part edited:
HTML:
<xf:if is="$post.attach_count">
<xf:macro id="message_macros::attachments"
arg-attachments="{$post.Attachments}"
arg-message="{$post}"
arg-canView="{{ $thread.canViewAttachments() }}" />
</xf:if>
With this:
HTML:
<xf:if is="$post.attach_count && !($post.isFirstPost() && $thread.discussion_type === 'story')">
<xf:macro id="message_macros::attachments"
arg-attachments="{$post.Attachments}"
arg-message="{$post}"
arg-canView="{{ $thread.canViewAttachments() }}" />
</xf:if>
This does not show all the changes to the
post_macros
I have made. If people are interested I'll share that as well.Attachments
Last edited: