Welcome Guest, Not a member yet? Register   Sign In
Croping problem
#1

[eluser]lucky8919[/eluser]
Hi there,

I'm having a problem when I've to resize and crop an image. For some reason after the cropping process is finish it's leaving a grey space between the image and the space that was cropped.

This is my code:

Code:
$w_orig = $file_data['image_width'];
  $h_orig = $file_data['image_height'];
  
  if ( $w_orig > $this->config['width'] )
  {
   $w_med = $this->config['width'];
   $h_med = ( $h_orig * $this->config['width'] ) / $w_orig;
  }
  else
  {
   $w_med  = $w_orig;
   $h_med  = $h_orig;
  }
  
  // global config
  $config['image_library']  = 'gd2';
  $config['source_image']  = $file_data['full_path'];
  $config['create_thumb']  = FALSE;
  $config['maintain_ratio']  = FALSE;
  $config['width']         = $w_med;
  $config['height']        = $h_med;
  
  $this->CI->image_lib->initialize ( $config );
  $this->CI->image_lib->resize();
  
  $imageSize = $this->CI->image_lib->get_image_properties($config['source_image'], TRUE);
  
    // axis settings
  $config['image_library']  = 'gd';
  $config['source_image']  = $file_data['full_path'];
  $config['create_thumb']  = FALSE;
  $config['maintain_ratio']  = FALSE;
  $config['x_axis']         = 0;
  $config['y_axis']        = ( ( $imageSize['height'] / 2 ) - ( $this->config['height'] / 2 ) );
  
  $this->CI->image_lib->initialize ( $config );
  $this->CI->image_lib->crop();
  $this->CI->image_lib->clear();

I'm leaving an image so you can see more clearly what my problem is.

I hope you can help me.

Thanks!


Messages In This Thread
Croping problem - by El Forum - 10-18-2013, 12:31 PM
Croping problem - by El Forum - 10-19-2013, 02:35 PM
Croping problem - by El Forum - 10-20-2013, 07:39 AM



Theme © iAndrew 2016 - Forum software by © MyBB