Gossamer Forum
Home : Products : Gossamer Forum : Discussion :

Inline Image stored on server?

Quote Reply
Inline Image stored on server?
has this been addressed? I have seen two threads in the past, but no solution.

It would seem possible to have the attachments to appear in the message body using [attach1], [attach2] tags, etc.

My needs:

1) to have an inline image uploaded, and stored on the server.

2) to limit this ability to the first message of a thread only.

#1 is not so trivial if it's to be generalized to all installs

#2 should be fairly trivial through a plugin hook on message-post/edit.

I have not done any GF coding despite having the program since the beta, but I now have to set up some customized installations that blend GF and Links SQL.

It would seem possible to hook the attachments on message display, and convert them to in-line tags. If a message has attachments put the link code into [attachN] etc.

If this has not been done already, then I have a project that I have to do immediately, and any input would be appreciated:

1) upload/attach images to a message -- this is mostly already built in

2) thumbnail the images that are attached -- I have thumbnail code

3) display the thumbnail in the message body (attachment icon) -- this requires display hook?

4) allow the full-sized image to be in-lined with some sort of flag -- this is a database design element, most likely

5) provide the ability to limit this to the first message and/or original poster only -- display/edit/update/etc hook

Suggestions would be greatly appreciated!!

(the reason for this is a "critique" board where an image can be uploaded and then the following messages would be related to that image post -- no "crossposting" allowed.)


PUGDOG´┐Ż Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] Inline Image stored on server? In reply to
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

Last edited by:

Jagerman: Jan 4, 2003, 10:04 PM