Welcome Guest, Not a member yet? Register   Sign In
Memory issues with ZIP Library
#1

[eluser]Xenon Design[/eluser]
Ive made a function to download some user selected image files and zip them and offer for download. Now my issue is that I am getting a PHP error.

This is the error:
Quote:Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 473365 bytes)

The line in which it relates to is 171 on libraries/Zip.php which is as follows:
Code:
$newoffset = strlen(implode("", $this->zipdata));

The function in my code that does all of this:
Code:
$rooturl = $this->config->item("base_url");
$this->load->library("zip");
$items = split(",", $this->input->post("items"));
$this->zip->clear_data();
$files = array();

$type = $this->uri->segment(4);

//var_dump($items);

foreach($items as $item){
    if($item != "null"){
        $data = $this->gallery->get_photo_data(0, $item);
        $files['photo_'.$data['photoid'].'.jpg'] = file_get_contents($rooturl."static/gallerybatch/".$data['batchid']."/".$data['filename'].".jpg");
    }
}

$this->zip->add_data($files);

$this->zip->download("images.zip");

There are about 23 images it is trying to download with each photo being around 300KB-600KB. Of course downloading only 5 or so images does work but the clients using this will need the whole lot when needed.

Now im pretty sure it has to do with some PHP or Apache settings some where to memory limits but buggered if i know where they are.

If anyone can help me that would be greatly appreciated. If you want to know more info on the issue then let me know and ill give what you need.


Messages In This Thread
Memory issues with ZIP Library - by El Forum - 12-08-2007, 05:54 AM
Memory issues with ZIP Library - by El Forum - 12-08-2007, 08:10 AM
Memory issues with ZIP Library - by El Forum - 12-08-2007, 07:23 PM
Memory issues with ZIP Library - by El Forum - 12-08-2007, 08:36 PM
Memory issues with ZIP Library - by El Forum - 10-15-2009, 08:28 PM



Theme © iAndrew 2016 - Forum software by © MyBB