0

In my application I have to create some zip files and send them in mail through PHP.

Creating Zip files functionality is done using ZipArchive class. but it reducing file size up to 35-40 %. My client wants more then 60% size reduction.

Is there any other library or way to to this with ZipArchive class?

Is it possible with shell command which I can execute in my php script using exec() ?

Shaeldon
  • 873
  • 4
  • 18
  • 28
Lucifer
  • 264
  • 1
  • 5
  • 12
  • 1
    ZIP is a fixed algorithm, you cannot get more compression, it depends on the data being compressed. If you want more compression, use another (better) compression algorithm like 7Zip. – m0skit0 Dec 04 '12 at 09:35
  • 3
    It all depends on the content. Can you compress the content using any other zip utility by more than 60%? – deceze Dec 04 '12 at 09:35
  • I don't think you have control over the zip compression. How much it gets compressed depends on what you're compressing – kennypu Dec 04 '12 at 09:36
  • if It's possible with 7zip or other algo . Is the any library/class for integrating with PHP script ? – Lucifer Dec 04 '12 at 09:38
  • Will the recipient always be the same person, or will arbitrary users have to open that file? Because 7zip is not very widely supported out of the box. – deceze Dec 04 '12 at 09:39
  • @deceze:Most Probably Same person. In case if they are different then limited number we can ask them to install required software – Lucifer Dec 04 '12 at 09:41

1 Answers1

0

The zip algorithm should be the same regardless of the library you are using. So you can't expect an improvement by using a different library. Perhaps a different archive algorithm might suit your content better.

The compression rate largely depends on the content being compressed. By example, you'll get a very good compression rate when compressing a text file containing nothing but 'a' characters, but an irrelevant compression rate for an mp3 by example.

  • Thanks... 90% files are PDF rest rtf and xml. then ? – Lucifer Dec 04 '12 at 09:43
  • 1
    the pdf allows for compression within pdf files. so you might not get very good results with pdfs. see a talk here: http://stackoverflow.com/questions/10547890/are-all-pdf-files-compressed –  Dec 04 '12 at 09:51
  • 1
    also, adding the 'compression' tag to your question might help you get some knowledgable responses. –  Dec 04 '12 at 09:52