codingmasterRS Posted August 12, 2010 Share Posted August 12, 2010 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 More sharing options...
codingmasterRS Posted August 12, 2010 Author Share Posted August 12, 2010 any suggestions are welcome Link to comment https://forums.phpfreaks.com/topic/210539-compression-of-different-file-formats/#findComment-1098507 Share on other sites More sharing options...
AbraCadaver Posted August 12, 2010 Share Posted August 12, 2010 http://us3.php.net/manual/en/refs.compression.php As for the requirements, you'll need to test on some of your files as many images, videos and music files are already compressed in some fashion. Link to comment https://forums.phpfreaks.com/topic/210539-compression-of-different-file-formats/#findComment-1098515 Share on other sites More sharing options...
codingmasterRS Posted August 12, 2010 Author Share Posted August 12, 2010 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? Link to comment https://forums.phpfreaks.com/topic/210539-compression-of-different-file-formats/#findComment-1098520 Share on other sites More sharing options...
AbraCadaver Posted August 12, 2010 Share Posted August 12, 2010 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. Link to comment https://forums.phpfreaks.com/topic/210539-compression-of-different-file-formats/#findComment-1098525 Share on other sites More sharing options...
codingmasterRS Posted August 12, 2010 Author Share Posted August 12, 2010 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? Link to comment https://forums.phpfreaks.com/topic/210539-compression-of-different-file-formats/#findComment-1098539 Share on other sites More sharing options...
codingmasterRS Posted August 13, 2010 Author Share Posted August 13, 2010 opinions? Link to comment https://forums.phpfreaks.com/topic/210539-compression-of-different-file-formats/#findComment-1098786 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.