MyBB Community Forums

Full Version: Image Uploader
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I want to learn html coding and at the same time think it would be cool to host an image/file uploader similar to the likes of imageshack, photobucket, etc. Now of course my created image uploader won't compare to those sites, but I think it would be cool none the less to host such a site.

If anyone is interested in helping me, please PM or post here.
Well first, you need to learn more then html. You need to learn PhP, and its not easy. I'd recomend doing a smaller project before making a huge one. Because its so easy to abuse an image host.
That is true, and I fully agree with T0m as I said in the PM I can help you with the basic stuff like storing the image, hashing the image and generation a thumb with out the GD Library but load an image in 100x100 px or what ever style.
I am building a network of sites, with an image uploader complete homepage, forum and main site (but big on each) trust me. Building a secure one from bare nothing is hard. Trust me.
I never said it will be easy ^^

I can only supply a basic script rather then anything complex. The script is pretty simple

1 - Select File
2 - Click Upload
3 - System hashes name ex; 6848hash4jaj4jsjt56wksad you can choose use extension or not.
4 - System generates a preview using upload image in any size you want
5 - System generates tags like, embed of the images using BBCode and other stuff.
That still more then i have done or are even working for xD. I was skipping hashing. Is it needed really? Because if so i have to pretty much restart...
I hashed it with double lair. I used mt_rand(0000, 9999) to add a 4 digit number to the image name and then I used sha1 and md5 to double hash the entire thing, I also removed the use of extension so the file became, like this 78JKlfh67k4wlsdt instead of say no-pic.jpg ^^

Its your choice to hash but its not needed.
(2009-10-26, 07:23 PM)T0m Wrote: [ -> ]That still more then i have done or are even working for xD. I was skipping hashing. Is it needed really? Because if so i have to pretty much restart...

Its better to hash files and store them using the hash names, that prevents over-writing if someone uploads a file with a name similar to one that already exists.

(2009-10-26, 09:11 PM)Deadriot Wrote: [ -> ]I hashed it with double lair. I used mt_rand(0000, 9999) to add a 4 digit number to the image name and then I used sha1 and md5 to double hash the entire thing, I also removed the use of extension so the file became, like this 78JKlfh67k4wlsdt instead of say no-pic.jpg ^^

Its your choice to hash but its not needed.

I've always wondered if there is any benefit to having such complex hashes just to generate a unique hash, I usually just do a md5($filename.time())
No idea I just use something like this

md5(mt_rand(0000, 9999)); and then when this is added to the new filename I use sha1 to double hash the entire thing ^^

So for example the file is named like this:
Minitokyo.The.Melancholy.of.Suzumiya.Haruhi.Scans_338473.jpg

And the end result when its upload is like this:
view.cfm/c51ce410c124a10e0db5e4b97fc2af39Minitokyo.The.Melancholy.of.Suzumiya.Haruhi.Scans_338473.jpg?pid=Minitokyo.The.Melancholy.of.Suzumiya.Haruhi.Scans_338473.jpg

here is a bits of code ^^
$random_ts=mt_rand(0000,9999);
$random_token=mt_rand(000000, 999999);

$new_file_name=md5($random_token).($file_name).($random_ts);

This will resolve a data with a bit more unique structure as here:
view.cfm/9d70a5d40ec67f2a52069f51d736a915Minitokyo.The.Melancholy.of.Suzumiya.Haruhi.Scans_338473.jpg6558?pid=Minitokyo.The.Melancholy.of.Suzumiya.Haruhi.Scans_338473.jpg

Notice the "6558" after .jpg even so the file will still be loaded as .jpg ^^ and can be read by any browser, it also takes up the same amount of space on the server and do to "9d70a5d40ec67f2a52069f51d736a915" md5 the system will not make the same file even if a I re-upload the same file over and over it will generate unique token and ts which stands for tem session ID.
Crap. Back to square one. Well thanks for the notice at least Toungue
Pages: 1 2