[eluser]metamorpher[/eluser]
I know this is an error for my server only, but I already modified my php.ini and assigned 512MB of the memory to process scripts, so I don't know why I have this problem, when for example I can process larger images (file size and image size) with such a blog tool like wordpress using just 8MB.
So, in detail, I put first the error
Code:
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 1280 bytes) in
/Applications/MAMP/frameworks/codeigniter2/libraries/Image_lib.php on line 1155
Now, How I do the upload:
Code:
$up_config['file_name'] = time();
$up_config['upload_path'] = MAINPATH . 'uploads/'; // MAINPATH is a constant I defined myself.
$up_config['allowed_types'] = 'jpg';
$up_config['max_size'] = '2048';
$this->load->library('upload', $up_config);
if($this->upload->do_upload('photo'))
{
$upload = $this->upload->data();
$this->random_tools_model->generate_thumbnail($upload['full_path'], 200);
}
and here's the thumbnail generator:
Code:
function generate_thumbnail($img_path_file, $size)
{
$this->load->library('image_lib');
$img_data = $this->image_lib->get_image_properties($img_path_file, TRUE);
if($img_data['width'] > $img_data['height'])
{
$conf['height'] = $size;
}
else if($img_data['width'] < $img_data['height'])
{
$conf['width'] = $size;
}
$conf['source_image'] = $img_path_file;
$conf['maintain_ratio'] = TRUE;
$conf['image_library'] = 'gd2';
if(!$this->image_lib->resize())
{
return false;
}
$this->image_lib->clear();
return true;
}
The max size it can process is like 600 px per 600 px
As I said, don't know why... I haven't had this problem with other scripts nor prior frameworks... I just moved to CI 2... Formerly I was using CI 1.7.
Can you help me at all?
Thank you in advance fellas