how to reduce zip size created with php

1

How can I reduce the size of a ZIP file created with PHP . I'm able to zip it but its size remains the same as I can decrease the size of it. for example I want to zip a 2MB file and when I zip I want ZIP to be less than 1MB or even 1MB how to do that?

My code

$zip = new ZipArchive();

if( $zip->open( 'teste/sample.zip' , ZipArchive::CREATE )  === true) {
    $zip->addFile(  'teste/arqtest.pdf' , 'arqtest.pdf' );

    $zip->close();
}
    
asked by anonymous 06.06.2017 / 19:26

1 answer

2

The zip algorithm is fixed. You can not get a higher compression because the compression rate depends mainly on the type of data being compressed.

For example, you will have a very good compression rate when compressing a text file containing nothing but A characters, but an irrelevant compression ratio for a mp3 file, for example.

    
06.06.2017 / 19:40