php - Allowed memory size of bytes exhausted - Codeigniter -
when call library upload controller, error
fatal error: allowed memory size of 1073741824 bytes exhausted (tried allocate 65488 bytes) in d:\xampp\htdocs\symfony\web\system\core\log.php on line 478
controller method edit:
function edit($id){ $this->action ="edit"; if (empty($_post["id"])) $_post["id"] = $id; if(isset($_post['edit'])){ $_post['image'] = $this->model_img_upload->imageupload($this->imuploadconfig); if($this->model_akcii->edit_data($_post)){ $this->session->set_flashdata('msg',$this->lang->line('msg_edit')); redirect('akcii'); } } $this->item = $this->model_akcii->get_info($id); $this->item_lang = $this->model_akcii->get_lang_info($id); $this->load->view("edit",$this); }
imageupload method:
function imageupload ($config=array()){ if(isset($_files['userfile'])){ $_files['userfile']['name'] = $this->transliterate($_files['userfile']['name']); $config['upload_path'] = isset($config['upload_path'])?$config['upload_path']:$_server['document_root'].'/userfiles/images/' ; if (!file_exists($config['upload_path'])) if (phpversion() >= 5) mkdir($config['upload_path'],0755,true); else { $paths = split("/",$config['upload_path']); $makepath=""; foreach ($paths $p){ $makepath .=$p."/"; if (!file_exists($makepath)) mkdir($makepath,0755); } } $config['allowed_types'] = isset($config['allowed_types'])?$config['allowed_types']:'jpg|gif|png' ; $config['max_size'] = isset($config['max_size'])?$config['max_size']:'1000' ; $config['max_width'] = isset($config['max_width'])?$config['max_width']:'2048' ; $config['max_height'] = isset($config['max_height'])?$config['max_height']:'2048' ; $this->load->library('upload', $config); if ( ! $this->upload->do_upload()) { $error = array('error' => $this->upload->display_errors()); return false; } else { $imgdata = $this->upload->data(); $config['image_library'] = 'gd2' ; $config['source_image'] = $imgdata['full_path']; $config['quality'] = isset($config['quality'])?$config['quality']:"100%" ; $config['create_thumb'] = isset($config['create_thumb'])?$config['create_thumb']:true ; $config['maintain_ratio'] = isset($config['maintain_ratio'])?$config['maintain_ratio']:true ; $config['width'] = isset($config['width'])?$config['width']:140 ; $config['height'] = isset($config['height'])?$config['height']:115 ; $this->load->library('image_lib', $config); $this->image_lib->resize(); return $imgdata['file_name']; } }
this error appeared after upgrade engine codeigniter 3.
memory_limit = 1g
Comments
Post a Comment