Welcome Guest, Not a member yet? Register   Sign In
Crop Image not working as expected
#1

[eluser]imcl[/eluser]
I've posted this on SO to no avail, so here it goes.

I have this model to crop the user's image

Code:
function crop_avatar()
{
    $id = $this->tank_auth->get_user_id();

    //get current avatar
    $query = $this->db->get_where('user_profiles', array('id' => $id));
    foreach ($query->result() as $row) {
        $j[$row->avatar] = $row->avatar;
    }

    $config['image_library'] = 'gd';
    $config['source_image'] = '.' . substr("$row->avatar", 18);
    $config['x_axis'] = '10';
    $config['y_axis'] = '60';
    $this->load->library('image_lib');      
    $this->image_lib->initialize($config);

    if ( ! $this->image_lib->crop())
    {
        echo $this->image_lib->display_errors();
    }

//      print_r($config);


}
which generates this array (via print_r)

Code:
Array
(
    [image_library] => gd
    [source_image] => ./images/avatars/b0b623057.jpg
    [x_axis] => 10
    [y_axis] => 60
)

For some reason unknown to me - there's no cropping going on. The original image passes straight thru this model, and is unchanged.

I do have GD on my server -- any ideas what might be wrong here?

Thanks!




Theme © iAndrew 2016 - Forum software by © MyBB