• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Zip library - Large file processing

#1
Hi,

I am trying to create a zip file of various images. This works fine when there are a few images (size wise) but when the size of the total images exceeds a certain amount I get "Memory Allocation" errors. I am aware I can increase the server memory limit, but I am looking for a solution that does not require this.

Perhaps there is a way to split the files into multiple zip files and download them?

Controller
Code:
$this->load->model('project_model');
$this->load->library('zip');

$cat_name = $this->project_model->get_name();
$zipname = $cat_name->name;
$zipname = $zipname . '.zip';        

$path = 'images/';
$images = $this->project_model->get_gallery();
        
foreach($images as $row){
    $files = $path.$row['img_name'];
    $this->zip->read_file($files);
}        
       
$this->zip->download($zipname);

Any ideas? Thank you  Smile
Reply

#2
I found this read down and see the function/method type ZipFly()

Creating Large zip files in php

Hope this helps.
What did you Try? What did you Get? What did you Expect?

Joined the CodeIgniter Community in 2009.          ( Skype: insitfx )
Reply

#3
Thank you, will take a look and see if it helps.
Reply

#4
I'm not sure about the 'zip' thing, but when I had issues uploading large files, could be zips or different formats, I found plupload did the trick (you can browse the source on github), essentially it uses chunked uploads to get around the memory limitation issue you get when dealing with large file/uploads.

It might be worth a look at....

Also, I'd just like to add PHP isn't great for these kind of tasks, it is something you'd want to do with something like nodejs which supports non blocking IO...

Good info found here.
http://stackoverflow.com/questions/43570...ut-disk-cp
IgnitedCMS Pro
IgnitedCMS
Practical guide to IgnitedCMS - Book coming soon
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.