How to zip 2 images files and download the zip file? |
[eluser]chefnelone[/eluser]
Hello, I found this in the user guide to zip an existing file, works fine but just with one file. Code: $path = '/path/to/photo.jpg'; I need to zip 2 files and then download the zip file. Something like ( the code below is not working.. just to give an idea of what I need to do) Code: $path1 = '/path/to/photo.jpg';
[eluser]Cristian Gilè[/eluser]
Hi chefnelone, you can use $this->zip->read_dir() that permits you to compress a folder (and its contents) that already exists somewhere on your server. Code: $path = '/path/to/your/directory/'; //path where are stored your two files
[eluser]chefnelone[/eluser]
[quote author="Cristian Gilè" date="1294419861"]Hi chefnelone, you can use $this->zip->read_dir() that permits you to compress a folder (and its contents) that already exists somewhere on your server. Code: $path = '/path/to/your/directory/'; //path where are stored your two files I see, but the folder containing the images has another images that I don't want to include in the zip. I think I'll need to create a folder, move the images to this folder, then use $this->zip->read_dir($path); and delete the folder after. I believe that de Zip class should include a function to do this task this simpler...
[eluser]Cristian Gilè[/eluser]
Code: $path = 'path/to/file1';
[eluser]chefnelone[/eluser]
Rare, suddendly the zip class stop working if i try this code: I get rare characters as you can see in this image: image Code: function zip_files() Something to do with my server (I'm on localhost running on MAMP)???
[eluser]chefnelone[/eluser]
[quote author="Cristian Gilè" date="1294426390"]Don't echo nothing before zip file![/quote] nothing just the output through Firebug you can see in the image... rare it was working fine, maybe my server??? I have Firephp to output whatever info from the function zip_files, if this helps...
[eluser]Cristian Gilè[/eluser]
The rare character you see is the zip file output in the debug firephp var. Probably is a buffering output problem. Try do disable firephp or check if the directive output_buffering is On in your php.ini conf file and set it to Off.
[eluser]chefnelone[/eluser]
[quote author="Cristian Gilè" date="1294428098"]The rare character you see is the zip file output in the debug firephp var. Probably is a buffering output problem. Try do disable firephp or check if the directive output_buffering is On in your php.ini conf file and set it to Off.[/quote] output_buffering is set to Off I disabled Firephp I also restart my server (MAMP) but nope.... still not working
[eluser]Cristian Gilè[/eluser]
Do you call zip_files function from an anchor? Please, paste here a reduction code of your controller and view. |
Welcome Guest, Not a member yet? Register Sign In |