Welcome Guest, Not a member yet? Register   Sign In
Problem geting image resize to work
#1

[eluser]old_guy[/eluser]
Most likely an obvious solution but I can't see it. I'm uploading an image file to a folder, resizing it and then writing the image path to a dB.

The original image upload works and the image path gets inserted in the dB but the image resize doesn't happen.

Hope some can help me see the what I'm not doing...code follows:

Uploading an image file as follows works fine:

$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['overwrite'] = 'TRUE';
$this->load->library('upload', $config);

I then run a function to resize the image as follows:

$this->load->library('image_lib');
$config['image_library'] = 'gd2';
$config['source_image'] = array('image' => 'uploads/' .element('file_name', $this->upload->data()));
$config['create_thumb'] = FALSE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 250;
$config['height'] = 250;
$this->load->library('image_lib', $config);
$this->image_lib->resize();

And, finally I upload the image path to the dB:

$img_path = array('image' => 'uploads/' .element('file_name', $this->upload->data()));
$this->db->where('id', $id);
$this->db->update('personal', $img_path);


Messages In This Thread
Problem geting image resize to work - by El Forum - 09-03-2008, 02:50 PM
Problem geting image resize to work - by El Forum - 09-03-2008, 03:20 PM
Problem geting image resize to work - by El Forum - 09-03-2008, 03:34 PM
Problem geting image resize to work - by El Forum - 09-03-2008, 03:56 PM



Theme © iAndrew 2016 - Forum software by © MyBB