943,708 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 4056
  • PHP RSS
Nov 9th, 2008
0

FILE UPLOAD - Is there a way to compress file size on upload?

Expand Post »
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
Reputation Points: 10
Solved Threads: 2
Junior Poster
justted is offline Offline
140 posts
since Dec 2007
Nov 9th, 2008
0

Re: FILE UPLOAD - Is there a way to compress file size on upload?

Click to Expand / Collapse  Quote originally posted by justted ...
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
Quote ...
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.
You'd never get 1000x10x100,000. You'd get a much lower number realistically.

What you'd have to ask is weather each member is worth that much space... yes.

Quote ...
Is there anyway to compres the files that members upload.
You could first convert the uploaded images to a compressed format. This usually means JPG - I would guess. You can also optimize the JPG server side, make sure you save lower quality if the image is very high quality.

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).
Moderator
Reputation Points: 457
Solved Threads: 101
Nearly a Posting Virtuoso
digital-ether is offline Offline
1,250 posts
since Sep 2005
Nov 10th, 2008
0

Re: FILE UPLOAD - Is there a way to compress file size on 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).
Indeed, a JPG compressed file does not compress good in gzip, even if strong or strongest compression is used.
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.
Reputation Points: 21
Solved Threads: 26
Posting Whiz in Training
Rhyan is offline Offline
240 posts
since Oct 2006
Nov 10th, 2008
1

Re: FILE UPLOAD - Is there a way to compress file size on upload?

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.
Last edited by martin5211; Nov 10th, 2008 at 12:14 pm.
Reputation Points: 52
Solved Threads: 23
Posting Whiz in Training
martin5211 is offline Offline
271 posts
since Aug 2007
Nov 11th, 2008
0

Re: FILE UPLOAD - Is there a way to compress file size on upload?

thank you NIGDE IN TURKEY
Reputation Points: 10
Solved Threads: 0
Newbie Poster
TROMERDOGUTR is offline Offline
1 posts
since Nov 2008
Nov 12th, 2008
0

Re: FILE UPLOAD - Is there a way to compress file size on upload?

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.
Sponsor
Featured Poster
Reputation Points: 410
Solved Threads: 258
Occupation: Genius
cwarn23 is offline Offline
3,004 posts
since Sep 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: about telebid.com
Next Thread in PHP Forum Timeline: upload progess bar in php using Ajax





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC