| | |
FILE UPLOAD - Is there a way to compress file size on upload?
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Dec 2007
Posts: 136
Reputation:
Solved Threads: 2
Hello,
I have been setting up a photo upload feature for a website which allows members to upload photos.
I am also after some advice on how large a file should be? I thought about allowing members to upload a photo up to 100,000 in size and allowing a maximum of 10 photos each but if I could expand this then it would be great. I just cant seem to find out how! obviously if I had a 1000 members for example each having 10 x 100,000 then thats a huge amount of space.
Is there anyway to compres the files that members upload. For example ...I see facebook which is well known for their photo uploads somehow compress the file and allow massive amounts of files on their servers.
Any advice would be great.
Thanks
I have been setting up a photo upload feature for a website which allows members to upload photos.
I am also after some advice on how large a file should be? I thought about allowing members to upload a photo up to 100,000 in size and allowing a maximum of 10 photos each but if I could expand this then it would be great. I just cant seem to find out how! obviously if I had a 1000 members for example each having 10 x 100,000 then thats a huge amount of space.
Is there anyway to compres the files that members upload. For example ...I see facebook which is well known for their photo uploads somehow compress the file and allow massive amounts of files on their servers.
Any advice would be great.
Thanks
•
•
•
•
Hello,
I have been setting up a photo upload feature for a website which allows members to upload photos.
I am also after some advice on how large a file should be? I thought about allowing members to upload a photo up to 100,000 in size and allowing a maximum of 10 photos each but if I could expand this then it would be great. I just cant seem to find out how! obviously if I had a 1000 members for example each having 10 x 100,000 then thats a huge amount of space.
Is there anyway to compres the files that members upload. For example ...I see facebook which is well known for their photo uploads somehow compress the file and allow massive amounts of files on their servers.
Any advice would be great.
Thanks
•
•
•
•
I just cant seem to find out how! obviously if I had a 1000 members for example each having 10 x 100,000 then thats a huge amount of space.
What you'd have to ask is weather each member is worth that much space... yes.
•
•
•
•
Is there anyway to compres the files that members upload.
Then you could also gzip it, and save the Gzipped version. Not sure how Gzip would play with the existing image compression, but I think it should reduce the size. (you have to test that, since compressing twice can increase the size).
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
•
•
•
•
Then you could also gzip it, and save the Gzipped version. Not sure how Gzip would play with the existing image compression, but I think it should reduce the size. (you have to test that, since compressing twice can increase the size).
It is important what kind of information is needed for a jpg stored online. For example, you can read the EXIF if it is important, and store it in a database, and then resample the image with stronger JPG compression and without EXIF, which will result to something like 130-160 KB for a 1600 x 1200 image with 60 - 70% jpg compression ratio. So when requested, you can show both the exif and still have the image in relatively good quality in relatively big size.
If you must in all cases store the original, then, you may limit your users to a monthly or total upload limit, that when exhausted (either by 10 or by 1000 images),does not allow furhter uploads, and you can leave the images intact.
Last edited by Rhyan; Nov 10th, 2008 at 10:19 am.
" Of all the things I've lost,
I miss my mind the most...."
Mark Twain
I miss my mind the most...."
Mark Twain
•
•
Join Date: Aug 2007
Posts: 189
Reputation:
Solved Threads: 14
Facebook and another community sites achieves this optimal capacities performing an image scale reduction and using lossless formats like JPEG for every photo uploaded. Data storage can be a concern on higher web sites, I think CPU usage should be another factor to be considered. You can make a heavy amount of CPU load killing the server resources trying to recompress files that already uses a compression on their data. Also, Lempel-Ziv (.gz .zip) compression will give bigger files as a result (if you're using JPEG images).
The GD library would give the essential functions to do image processing like format conversion and reducing images to the maximum visible dimensions into the website template.
The GD library would give the essential functions to do image processing like format conversion and reducing images to the maximum visible dimensions into the website template.
Last edited by martin5211; Nov 10th, 2008 at 12:14 pm.
Another thing you can do to reduce the space used is to use bicubic resize the make the images half the height and half the width but for large images this technique can use a lot of cpu when resizing them back with a bicubic resize unless you just use html to pixel resize to the original size.
Try not to bump 10 year old threads as it can be really annoying.
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
![]() |
Other Threads in the PHP Forum
- Previous Thread: about telebid.com
- Next Thread: upload progess bar in php using Ajax
| Thread Tools | Search this Thread |
advanced apache api array basics beginner binary broken cakephp check checkbox class cms code codingproblem combobox cookies cron curl database date datepart display dynamic echo email error file files folder form forms function functions google head href htaccess html image include includingmysecondfileinthechain insert ip javascript job joomla js limit link login mail menu mlm mobile multiple mysql oop outofmemmory paging parse password paypal pdf php problem procedure query radio random recursion remote script search server sessions smarty sms soap source space sql stored syntax system table traffic tutorial unicode up-to-date update upload url validator variable video web webapplications xml youtube






