coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: deltafun on January 11, 2006, 11:15:55 AM

Title: PHP5 ZIP Errors
Post by: deltafun on January 11, 2006, 11:15:55 AM
Hi,

I am having a single problem with cpg1.4.3 and PHP 5.0.3.

The "Download Favourites as ZIP" goes a little wrong it seems.

The ZIP file is downloaded correctly, and opens correctly, and it contains the correct filenames at the rights sizes. However when I try to decompress the images with winzip I get the following error:

Error:  invalid compressed data to inflate

If I switch back to php4, then everything works fine.

Also if I change "zipdownload.php" to be:
$zip = new [b]tar[/b]file($cwd,$flags);
$zip->addfiles($filelist);
$zip->filedownload('pictures.[b]tar[/b]');


Rather than the orig:

$zip = new zipfile($cwd,$flags);
$zip->addfiles($filelist);
$zip->filedownload('pictures.zip');


Then a tar file successfully downloads, opens and the contents can be extracted with no problems.

I have got a few other people to open the zip file as well with the same result.

One of them ( late last night ) told me that "the zip file was not a zip file but a tar file as it has no header information".

You can download a copy of the zip file from http://www.skgnet.com/pictures.zip (http://www.skgnet.com/pictures.zip)

Hope someone can help as i`m really stumped.

Regards

David
Title: Re: PHP5 ZIP Errors
Post by: deltafun on January 17, 2006, 04:47:02 PM
The solution to this turned out to the the obvious :(

I needed to enable zlib in my php.ini, as it was not by default on my host, but is by default in the php4 version they run. So when I was switching between them the issues occured, leading to confusion.

It appears that with zlib not enabled then the download zip scripts default to creating tar files, but still naming it a zip file.

Its just a bit different to GD2/Imagemagick etc where coppermine tells you that they are not available, and kind of odd in that the zip file is created even though the required library to do so does not exist.