It isn't there now, but for version 2 I'm thinking of adding something allowing you to upload pictures to a post (they would be stored as ordinary post attachments, but probably with some flag set telling them not to show up in the attachment list). It probably won't, however, handle thumbnailing the images, or have the permission for just the first poster, but I don't see applying something like that using a plugin being particularly difficult. But that's version 2, which isn't here yet.
Displaying an image stored as a post attachment is possible, and people have demonstrated it before (I've done so below). Currently, however, it cannot been done in just a single step - it also requires an edit because until the post is actually made, the attachments are in the temporary attachment table and path; it isn't until posting that they are moved into the post attachment table. Obviously, this is not very useful except to show that it can be done.
There are a couple of ways you could go about doing it. Going along the more version-2-ish route would be to store the image as an attachment (you might be able to store the thumbnail as such as well).
For displaying the image, I think you'd want to use a post hook on "post_normalize" - take a look at what it does with the post_message field (it's initially a code reference, which you'll need to call, but then sets itself to the string after being called). It'll be a few selects to figure out just which attachment is involved (this is broken up into directories; attachment ID 1234 would be saved as admin/attachments/post/4/1234). You need to produce a thumbnail from the image, save it somewhere, then add an <img src="/thumbnail/...">, possibly linked to gforum.cgi?do=post_attachment;postatt_id=1234. You'd (probably) also want adjust the attachments in the hook so that they don't show up below the post.
A second way you could go about doing it would be to forget about GForum attachments - use the edit and post hooks and handle the image upload and display yourself. You'd still need the normalize hook, above, to display the image at the bottom of the post.
Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Displaying an image stored as a post attachment is possible, and people have demonstrated it before (I've done so below). Currently, however, it cannot been done in just a single step - it also requires an edit because until the post is actually made, the attachments are in the temporary attachment table and path; it isn't until posting that they are moved into the post attachment table. Obviously, this is not very useful except to show that it can be done.
There are a couple of ways you could go about doing it. Going along the more version-2-ish route would be to store the image as an attachment (you might be able to store the thumbnail as such as well).
For displaying the image, I think you'd want to use a post hook on "post_normalize" - take a look at what it does with the post_message field (it's initially a code reference, which you'll need to call, but then sets itself to the string after being called). It'll be a few selects to figure out just which attachment is involved (this is broken up into directories; attachment ID 1234 would be saved as admin/attachments/post/4/1234). You need to produce a thumbnail from the image, save it somewhere, then add an <img src="/thumbnail/...">, possibly linked to gforum.cgi?do=post_attachment;postatt_id=1234. You'd (probably) also want adjust the attachments in the hook so that they don't show up below the post.
A second way you could go about doing it would be to forget about GForum attachments - use the edit and post hooks and handle the image upload and display yourself. You'd still need the normalize hook, above, to display the image at the bottom of the post.
Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com