I am trying to give my forum the attachment (only images) preview ability...
I am trying to realize this with BBCode: when people select the image they want to add in the post, and then click on the "upload" button (I'll create one anyway), the image (say "image1.jpg") will be then uploaded to the..say "attachment" folder, and a piece of code will be automatically inserted into the message body, sth like:
[upload]attachment/image1.jpg[/upload]
the [upload] tag will be defined as <img src="$1" onload="javascript:if(this.width>600 this.style.width=600;">$1</img>
In this way, people can not only preview the attached image, downscale the image dimension, and can also add image description by typing below the code. If they want to 'detach' the image, they can just wipe the code, and it'll do the job (though the image isn't REALLY detached, as it's already uploaded to the server). They can also copy and paste the code so as to postion the image (or images) and make it appear the place they want it to be in the post.
The only problems are:
1. the "detached" images will stay on the server and need to be deleted manually. (however these 'dead' images won't take an awful large amount of space, not a big concern for me)
2. obviously I can't limit how much attachments each post is allowed. But I am thinking to limit the total amount of attachments a user can attach in a day (or maybe every 2 hours). Once he/she click on the "attach" button, it will be counted as once, and he/she will be notified of the number of attachment that's left for the day (or for this 2 hours). (this function is only for security purpose... in case people try to 'attack' the forum by stuffing the disk space with uploads)
It would be cool an icon (a clip or whatever) will appear at the start of the post title, so viewers will know that this post has attachment(s).
For non-image attachments, we can just use another BBCode such as
[file][/file], and to achieve the same purpose - no need to reattach when previewing the post as currently is. (I only enabled 'gif', 'jpg', 'jpeg' on my board, but non-image attachment function might be useful for other forum administrators)
Could you guys please help produce the MOD, as I really need this preview and image description for my board? I am totally new to PHP and Forum programing, what I know is only design and some HTML, so could anyone of you please help?
Thanks a billlion!