This is a simple way how to view an image preview when creating a new thread (XThreads attachments only). The preview will be displayed when we hit the Preview Post button. This also works for edit post preview.
In image custom thread fields (in this example, we use
img1 as key), use this kind of code in display format:
Depends on how our display format, we can modify it as our needs (maybe using <else> before the if condition closed).
We need to put {$GLOBALS['threadfields']['key']['value']} variable in our newthread or template_prefix_newthread or template_prefix_editpost or template_prefix_editpost_first template. In this example, because we use img1 as key, so, we need to put {$GLOBALS['threadfields']['img1']['value']} variable.
If we have more than one image field type in that forum, and we want to display the preview for each image, use the similar display format with another key and id. Maybe it's better if we set the fields as hidden, and put the inputrow manually in our newthread or template_prefix_newthread or template_prefix_editpost or template_prefix_editpost_first template, then put the {$GLOBALS['threadfields']['key']['value']} variable after each inputrow.
Other method, maybe we can use the prefix_previewpost template to place the preview image.
Screenshots:
Create a new thread:
Hit the Preview Post button:
We can select one of the URL (hit the select button, example: BBCODE URL), and insert it to post body to be used in our post.
Useless maybe. I just want to share it