Jump to content

Compression of different file formats


codingmasterRS

Recommended Posts

I am looking at using PHP (or whatever) to compress images/video/music when it is uploaded to be stored on the server and decompressed when required on the webpage. I know I will have to make a decompress function so it knows when to decompress to its full size, but any ideas on how to do the compression.

 

Requirements: biggest, best and efficient compression of music/image/video files.

 

 

Thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/210539-compression-of-different-file-formats/
Share on other sites

so before it uploads it would do it to the file, how would you get it to do it to the file and not the file name before it saved it to the server and what are the compression rates (% of original size) for what you listed please?

You can't compress before the upload with PHP.  The compression rates are roughly the same for the listed compressions, but it will depend on the file itself.  I just tested on a 1MB PNG image and zip and gzip were the same but only saved 3 KB and bz2 saved 11 KB.  As I said, many of the types of files that you listed are already compressed to some extent and you may not see much improvement by compressing them again.

There will be a large amount of videos/images stored so I need a good way of compressing them to reduce space. I also have been told I should automatically scale the images to what the biggest would be on the site possible and also reduce all to JPG and then to 70% quality? Opinions?

 

Thanks for the help so far AbraCadaver, PS could you supply the code you tested with?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.