PDA

View Full Version : Major Additions - Image/File Uploader


tnguy3n
04 Sep 2004, 21:47
Coded by tnguy3n for http://www.all4actions.net
Live Demo: http://www.all4actions.net (create a thread or reply)

Well, I wrote this lil script for my board so that my member can upload images/pics since my board host lots of images of movie stars and all such, and database grows really fast if using Attachment Manager. It's been released at my forum for a while now, and didn't have time to post it here... it's fully tested, but maybe there'r still few bugs may be found.

What can you do with this script?
- Allow certain membergroups to access the script
- Upload img/banner in signature (sig hosting)
- You can set the max width & height, in case ppl upload huge image & break table cell of your forum
- You can set max filesize and allow certain extensions to be uploaded

lots more features will be added to v.2 of the script, admin can add file extensions, filesize and keep track on upload dir via Admin CP.

P.S. Due to mah busy schedule, support for this hack will be very limited ... You guys can find me on at my board sometimes, or post bugs in this thread: http://all4actions.net/forums/showthread.php?t=3389

------

If you want certain membergroups to see this File/Image Uploader option, you can use conditional in your template, i.e:
<if condition="(is_member_of($bbuserinfo, 5)) OR (is_member_of($bbuserinfo, 6)) OR (is_member_of($bbuserinfo, 7)))">
[<a href="uploader.php?$session[sessionurl]" onClick="return popup(this, 'uploader');">Image Uploader</a>]</if>

tnguy3n
04 Sep 2004, 22:43
here goo few screenshots

MiskaTorn
04 Sep 2004, 22:46
Can you make it so that the pictures can only be posted on your domain or other selected ones as well? DOn't need people eaqting up my bandwidth again with this :(

Looks awesome though

tnguy3n
04 Sep 2004, 22:56
Can you make it so that the pictures can only be posted on your domain or other selected ones as well? DOn't need people eaqting up my bandwidth again with this :(

Looks awesome though

how about disabling hotlink?

nexialys
04 Sep 2004, 23:10
would be simply better if the attached files are included in the post, like when we add smilies in our posts... so users don't have to copy/paste the code...

Mr. HillBilly
04 Sep 2004, 23:42
Where can users see what images they have uploaded?

Mephisteus
04 Sep 2004, 23:44
omg omg omg omg omg omg omg omg omg ty :)

MindTrix
05 Sep 2004, 12:12
Will this allow uploads more than say 3mb though or is it only for very small files.

nexialys
05 Sep 2004, 12:32
@ Mindtrix : PHP upload is limited by your server, not by scripts...

ranger2kxlt
07 Sep 2004, 17:20
can you limit the number of files uploaded in one post?

TCB
07 Sep 2004, 17:27
Thanks, I will try :D


While editing the showthread_quickreply template, I kinda lost it after this:
<!--######## Scroll down about 3/4 of the page, look for: ######## -->

Look for your signature fieldset, and ABOVE IT, ADD:

What is the exact line that I need to look for, so that I can put the next thing above it? Because after 'look for' there's nothing to look for :surprised:

tnguy3n
08 Sep 2004, 00:29
Thanks, I will try :D


While editing the showthread_quickreply template, I kinda lost it after this:


What is the exact line that I need to look for, so that I can put the next thing above it? Because after 'look for' there's nothing to look for :surprised:


in showthread_quickreply, find:
<tr>
<td align="$stylevar[left]">

<fieldset class="fieldset" style="margin:$stylevar[formspacer]px 0px 0px 0px">
<legend>$vbphrase[options]</legend>
<div>
<if condition="$bbuserinfo['signature']">
<div style="float:$stylevar[right]">
<label for="cb_signature"><input type="checkbox" name="signature" value="1" id="cb_signature" tabindex="5" checked="checked" />$vbphrase[show_your_signature]</label>
</div>
</if>
<label for="qr_quickreply"><input type="checkbox" name="quickreply" value="1" id="qr_quickreply" accesskey="w" tabindex="4" />$vbphrase[quote_message_in_reply]</label>
</div>
</fieldset>

</td>
</tr>

Above it, add:

<tr>
<td align="$stylevar[left]">

<fieldset class="fieldset" style="margin:$stylevar[formspacer]px 0px 0px 0px">
<legend>Smilies & Image Uploader Option</legend>
<if condition="(is_member_of($bbuserinfo, 5)) OR (is_member_of($bbuserinfo, 6)) OR (is_member_of($bbuserinfo, 7)) OR (is_member_of($bbuserinfo, 8)) OR (is_member_of($bbuserinfo, 9)) OR (is_member_of($bbuserinfo, 11))">
<div style="float:$stylevar[right]"><lable>[<a href="uploader.php?$session[sessionurl]" onClick="return popup(this, 'notes');">Image Uploader</a>]</lable></div></if>
</fieldset>

</td>
</tr>

Milorad
14 Sep 2004, 17:52
what happens if a file already exists?

if its overwritten is there a way to make it generate an error instead?

tnguy3n
14 Sep 2004, 23:26
what happens if a file already exists?

if its overwritten is there a way to make it generate an error instead?
It won't overwrite, but to print an error message instead.

Natch
15 Sep 2004, 02:26
What about security issues - will it test to see if the file is an image ?

Reason I ask, is that with a tool like this, someone could upload a FTP php script and then access your whole server with web-server privileges...

tnguy3n
15 Sep 2004, 17:47
What about security issues - will it test to see if the file is an image ?

Reason I ask, is that with a tool like this, someone could upload a FTP php script and then access your whole server with web-server privileges...
You can set certain file extensions to be uploaded. Default set: jpg, jpeg, gif, png

Natch
15 Sep 2004, 19:57
Just checking that it will reject evilscript.jpg.php ?

tnguy3n
19 Sep 2004, 00:29
Just checking that it will reject evilscript.jpg.php ?
I used strrchr() function which searches from the end of the filename; therefore, .php will match as in evilscript.jpg.php.

Natch
20 Sep 2004, 02:06
I'll shaddup now then ;)

Ber|Art
18 Oct 2004, 16:11
Thank, very nice addition :)

Snatch
16 Nov 2004, 10:56
Great Hack, big ThX

but I have a question.

I would like that the hack for each day creat a folder into it upload the files
/04.10.2004/files
/05.10.2004/files

Greetz Snatch

Mickie D
16 Nov 2004, 11:00
i would not use the OR conditionals in templates i would use ||

as i have many problems with that conditional

if you have problems with the image upload option change


OR


to


||

Snatch
17 Nov 2004, 13:12
Hello ? canīt no one help me ?

Moya
19 Nov 2004, 02:29
Hello ? canīt no one help me ?


Why would you want to do it?

tnguy3n
25 Nov 2004, 07:14
Great Hack, big ThX

but I have a question.

I would like that the hack for each day creat a folder into it upload the files
/04.10.2004/files
/05.10.2004/files

Greetz Snatch
I'm releasing my Upload/Image Uploader v2 soon that will have all the functions/features request above. :)

SVTOA
25 Nov 2004, 17:53
would be simply better if the attached files are included in the post, like when we add smilies in our posts... so users don't have to copy/paste the code...

I think that is certainly doable and will see if I can get that to work.

With regard to the template edits, for editor_smilebox this looks a little cleaner:

insert at the bottom of the template:
<!-- added uploader link here -->
<fieldset id="uploader" title="Image Uploader">
<legend>Image Uploader</legend>
<table cellpadding="4" cellspacing="0" border="0" align="center">
<tr>
<td class="smallfont" colspan="$vboptions[smcolumns]">[<a href="uploader.php" onClick="return popup(this, 'uploader'); return false" title="Image Uploader">Upload Image</a>]</td>
</tr>
</table>
</fieldset>
<!-- end uploader link -->

LoOnEyToOnZ
25 Nov 2004, 19:42
Hi. Is it possible to add a watermark feature over uploaded images ?

we_scooter
03 Dec 2004, 11:41
ok i done all the steps in ur instructions txt file , what comes after that ???

plz explain what else should be done to make it work..?

we_scooter

TrangNgoc
13 Dec 2004, 01:12
Thanks tnguy3n *installed* :ermm:

qhoa
28 Jan 2005, 18:03
what happen the pic is not show on the post (just red X)
thanks

tnguy3n
28 Jan 2005, 18:50
right click on redX (broken image) to see where the image located on your server, then make proper adjustment.

qhoa
28 Jan 2005, 20:42
hey thanks i solved them
it is my bad (typo url in the upload. file)
again, thanks

NuclioN
04 Feb 2005, 12:54
It gives problems with the chmod. I'm sure this is set correct and all the paths are ok. It is showing other errors when the image is to large etc. but no upload possible.

CHIngs
15 May 2005, 20:30
How can I change the FILENAME to the USERID so that each user can only upload 1 file?

HeloHi
18 May 2005, 08:30
I'm releasing my Upload/Image Uploader v2 soon that will have all the functions/features request above. :)

I am subscribing to this thread in anticipation :)

This is exactly what I want when the daily folder creator is added :cool:

Great hack!

cdoyle
01 Jun 2005, 02:32
This sounds like a great hack, we also have the webpage hack installed on our forum, and have been looking for way to give our users a way to upload images to use with it.

Is V2 close to being released? If it is, I'll wait til it's ready before installing.

So everyone seems to be pretty happy with this one? Any major problems they've noticed?

Chris.

cdoyle
08 Jun 2005, 23:02
Anyword on the next version?

jsharper
02 Jul 2005, 21:36
Is it me, or is www.all4actions.net down/dead?

sketch42
15 Jul 2005, 05:33
heres some new installation instructions, that are much more clear i think.


wonderful hack all in all

esology
18 Jul 2005, 11:59
It gives problems with the chmod. I'm sure this is set correct and all the paths are ok. It is showing other errors when the image is to large etc. but no upload possible.
Me too. I have tried numerous paths in the uploader.php file. I know my path is right.

sketch42
09 Aug 2005, 18:23
Me too. I have tried numerous paths in the uploader.php file. I know my path is right.

is it possible that you can mak this have an extra button to make a thumbnail image? like after you upload you get this see attachment

and have a new bbcode for the image and thumbnail.. i think that would be an excellent addition

Hornstar
16 Sep 2005, 10:47
Ok, this is looking, nice, Can a user view all images that s/he has posted, incase they forget the url?

esology
27 Nov 2005, 13:17
Anyone try this with 3.5.1?

tnguy3n
27 Nov 2005, 17:19
I've built a new version of this hack, but I don't have an ETA for the release.

esology
27 Nov 2005, 19:56
Thanks for the reply. I was just about to start trying to make it work with the current version. Maybe I'll wait for the debut.

A.Ah
05 Feb 2006, 17:38
any update?

Tommy12345
24 Dec 2006, 16:36
This skip works perfectly, the best out there. It is simple but very customizable. Found security problem u are not using move_uploaded_file and is_uploaded_file command.